⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vampiredriversfunctions

📁 samba-3.0.22.tar.gz 编译smb服务器的源码
💻
📖 第 1 页 / 共 4 页
字号:
# -----------------------------------------------------------------------------# ----------- Create a list of all available printers -------------------------# -----------------------------------------------------------------------------#function helpwithcreateprinterlistwithUNCnames(){echo -e " \n\################################################################################# #                About createprinterlistwithUNCnames()...#                ----------------------------------------## PRECONDITIONS: 1) This function expects write access to the current directory. #		 2) This function expects to have the '\$nthost', #		    '\$ntprinteradmin' and '\$ntadminpasswd' variables set to#		    according values.## WHAT IT DOES: This function connects to the '\$nthost' (using the credentials#		'\$ntprinteradmin' with '\$ntadminpasswd'), retrieves a list of#		printqueues (with associated driver names) from that host (with#		the help of the 'rpcclient ... enumprinters' utility, and saves#		it under name and path '\${nthost}/printerlistwithUNCnames.txt'#		(ie. it also creates the '\$nthost' subdirectory in the current #		one). It further prints some more info to stdout.## IF IT DOESN'T WORK: It may happen that the function doesn't work at the first#		      time (there may be a connection problem). Just repeat a#		      few times. It may work then. You will recognize if it does.## HINT: The current values: 'nthost'=\"$nthost\"#			    'ntprinteradmin'=\"$ntprinteradmin\"#			    'ntadminpasswd'=<not shown here, check yourself!># ################################################################################"}# -----------------------------------------------------------------------------function createprinterlistwithUNCnames(){if stringinstring help $@ ; thenhelpwithcreateprinterlistwithUNCnames ;else	[ -d ${nthost} ] || mkdir -p ${nthost};	echo " "	echo " "	echo " "	echo "--> Running now function createprinterlistwithUNCnames()...."	echo "============================================================"	rpcclient -U"${ntprinteradmin}%${ntadminpasswd}" -c 'enumprinters' ${nthost} \	| grep "description:" \	| awk -F "[" '{ print $2 }' \	| awk -F "]" '{ print $1 }' \	| sort -f \	| uniq \	| tee \	${nthost}/printerlistwithUNCnames.txt;	NUMBEROFPRINTERS=`cat ${nthost}/printerlistwithUNCnames.txt| wc -l`;	echo " ";	echo "--> Finished in running function createprinterlistwithUNCnames....";	echo "=========================================================================="	echo "NUMBEROFPRINTERS retrieved from \"${nthost}\" is $NUMBEROFPRINTERS".;	echo "  -->  If you got \"0\" you may want to try again. <---";	echo "==========================================================================";	echo " ";	printerlistwithUNCnames=`cat ${nthost}/printerlistwithUNCnames.txt`;fi}# -----------------------------------------------------------------------------# ----------- Create a list of all printers which have (no) drivers -----------# -----------------------------------------------------------------------------#function helpwithcreatemapofprinterstodrivers(){echo -e " \n\################################################################################# #                About createmapofprinterdrivers()...#                ------------------------------------## PRECONDITIONS: 1) This function expects to find a subdirectory '\$nthost' and#		    the file '\${nthost}/printerlistwithUNCnames.txt' to exist.#		 2) This functions expects to have the '\$nthosts' variable set #		    to an according value.## WHAT IT DOES: This function dissects '\${nthost}/printerlistwithUNCnames.txt' #		and creates some other textfiles from its contents:#		- '\${nthost}/allprinternames.txt'#		- '\${nthost}/alldrivernames.txt'#		- '\${nthost}/allnonrawprinters.txt'#		- '\${nthost}/allrawprinters.txt'#		- '\${nthost}/printertodrivermap.txt'#		and further prints some more info to stdout.## HINT: You currently have defined: 'nthost'=\"$nthost\", which resolves above#	mentioned paths to:#			    - '${nthost}/allprinternames.txt'#			    - '${nthost}/alldrivernames.txt'#			    - '${nthost}/allnonrawprinters.txt'#			    - '${nthost}/allrawprinters.txt'#			    - '${nthost}/printertodrivermap.txt'#               ################################################################################"}# -----------------------------------------------------------------------------function createmapofprinterstodrivers(){if stringinstring help $@ ; thenhelpwithcreatemapofprinterstodrivers ;else	echo " "	echo " "	echo "--> Running now function createmapofprinterstodrivers()...."	echo "==========================================================="	echo " "	echo " "	echo "ALL PRINTERNAMES:"	echo "================="	echo " "	cat ${nthost}/printerlistwithUNCnames.txt \	| awk -F "\\" '{ print $4 }' \	| awk -F "," '{print $1}' \	| sort -f \	| uniq \	| tee \	${nthost}/allprinternames.txt; 		echo " "	echo " "	echo "ALL non-RAW PRINTERS:"	echo "====================="	echo " "	cat ${nthost}/printerlistwithUNCnames.txt \	| grep -v ",," \	| awk -F "\\" '{ print $4 }' \	| awk -F "," '{print $1}' \	| sort -f \	| uniq \	| tee \	${nthost}/allnonrawprinters.txt; 		echo " "	echo " "	echo "ALL RAW PRINTERS:"	echo "================"	echo " "	cat ${nthost}/printerlistwithUNCnames.txt \	| grep ",," \	| awk -F "\\" '{ print $4 }' \	| awk -F "," '{print $1}' \	| sort -f \	| uniq \	| tee \	${nthost}/allrawprinters.txt; 		echo " "	echo " "	echo "THE DRIVERNAMES:"	echo "================"	cat ${nthost}/printerlistwithUNCnames.txt \	| awk -F "," '{print $2 }' \	| grep -v "^$" \	| tee \	${nthost}/alldrivernames.txt;	echo " "	echo " "	echo "THE PRINTER-TO-DRIVER-MAP-FOR-non-RAW-PRINTERS:"	echo "==============================================="	cat ${nthost}/printerlistwithUNCnames.txt \	| awk -F "\\" '{ print $4 }' \	| awk -F "," '{ print "\"" $1 "\":\"" $2 "\"" }' \	| grep -v ":\"\"$" \	| tee \	${nthost}/printertodrivermap.txt 	echo -e "##########################\n#  printer:driver  #" >> ${nthost}/printertodrivermap.txtfi}# -----------------------------------------------------------------------------# ----------- Create a list of all printers which have drivers ----------------# -----------------------------------------------------------------------------#function helpwithgetdrivernamelist(){echo -e " \n\################################################################################# #                About getdrivernamelist()...#                ----------------------------## PRECONDITIONS: 1) This function expects to find the subdirectory '\$nthost\'#		    otherwise it creates it...## WHAT IT DOES: This function creates the '\${nthost}/printernamelist.txt'#		and also prints it to <stdout>. To do so, it must contact the#		'\$nthost' via rpcclient (which in turn needs '\$ntprinteradmin'#		'\$ntadminpasswd' to log in....).# # HINT: The current values: 'nthost'=\"$nthost\"#			    'ntprinteradmin'=\"$ntprinteradmin\"#			    'ntadminpasswd'=<not shown here, check yourself!>#       which resolves above mentioned path to:#				    - '${nthost}/printernamelist.txt'#               ################################################################################"}# -----------------------------------------------------------------------------function getdrivernamelist(){if stringinstring $@ ; thenhelpwithgetdrivernamelist ;else	[ -d ${nthost} ] || mkdir -p ${nthost};	echo " "	echo " "	echo "--> Running now function getdrivernamelist()...."	echo "================================================"	rpcclient -U${ntprinteradmin}%${ntadminpasswd} -c 'enumprinters' ${nthost} \	| grep "description:" \	| grep -v ",," \	| awk -F "," '{ print $2 }' \	| sort -f \	| uniq \	| tee \	${nthost}/drivernamelist.txtfi}# -----------------------------------------------------------------------------# ----------- Split the driverfile listing between the architectures ----------# -----------------------------------------------------------------------------#function helpwithsplitenumdrivers3list(){echo -e " \n\################################################################################# #                About splitenumdrivers3list()...#                --------------------------------## PRECONDITIONS: 1) This function expects write access to the current directory#		    and its subdirs '\$nthost/*'. #		 2) This function expects to have the '\$nthost' variable set to#		    the according value.# # WHAT IT DOES: This function dissects the '\$nthost/enumdrivers3list.txt' #		(using "sed", "cat", "awk" and "grep"). It splits the list up#		into two different files representing a complete list of drivers#		and files for each of the 2 supported architectures. It creates #		'\${nthost}/W32X86/${nthost}-enumdrivers3list-NTx86.txt'#		and '\${nthost}/WIN40/${nthost}-enumdrivers3list-WIN40.txt'.# # IF IT DOESN'T WORK: The function "fetchenumdrivers3listfromNThost" may not #		      have been run successfully. This is a precondition for#		      the current function.## HINT: You currently have defined: 'nthost'=\"$nthost\", which resolves above # mentioned paths to:#		      - '${nthost}/WIN40/${nthost}-enumdrivers3list-NTx86.txt'#		      - '${nthost}/W32X86/${nthost}-enumdrivers3list-NTx86.txt'#################################################################################"}# -----------------------------------------------------------------------------function splitenumdrivers3list(){if stringinstring help $@ ; thenhelpwithsplitenumdrivers3list ;else	echo " "	echo " "	echo "--> Running now function splitenumdrivers3list()...."	echo "===================================================="		[ -d ${nthost}/WIN40 ]  || mkdir -p ${nthost}/WIN40;	[ -d ${nthost}/W32X86 ] || mkdir -p ${nthost}/W32X86;		cat ${nthost}/enumdrivers3list.txt \	| sed -e '/^\[Windows NT x86\]/,$ d' \	| tee \	${nthost}/WIN40/${nthost}-enumdrivers3list-WIN40.txt ;		cat ${nthost}/WIN40/${nthost}-enumdrivers3list-WIN40.txt \	| grep Version \	| sort -f \	| uniq \	| awk -F "[" '{ print $2 }' \	| awk -F "]" '{ print $1 }' \	| tee ${nthost}/WIN40/availableversionsWIN40.txt ;#	cd ${nthost}/WIN40/ ;#	mkdir $( cat availableversionsWIN40.txt ) 2> /dev/null ;#	cd - ;		cat ${nthost}/enumdrivers3list.txt \	| sed -e '/^\[Windows NT x86\]/,$! d' \	| tee \	${nthost}/W32X86/${nthost}-enumdrivers3list-NTx86.txt ;		cat ${nthost}/W32X86/${nthost}-enumdrivers3list-NTx86.txt \	| grep Version \	| sort -f \	| uniq \	| awk -F "[" '{ print $2 }' \	| awk -F "]" '{ print $1 }' \	| tee ${nthost}/W32X86/availableversionsW32X86.txt ;#	cd ${nthost}/W32X86/ ;#	mkdir $( cat availableversionsW32X86.txt ) 2> /dev/null ;#	cd - ;fi}# -----------------------------------------------------------------------------# ---------- Make subdirs in ./${sambahost}/WIN40/ for each driver.... -------# -----------------------------------------------------------------------------#function helpwithmakesubdirsforWIN40driverlist(){echo -e " \n\################################################################################# # About makesubdirsforWIN40driverlist() and makesubdirsforWIN40driverlist ()...# -----------------------------------------------------------------------------## PRECONDITIONS: 1) These functions expect write access to the current directory#		 2) These functions expect to have the '\$nthost' variable set #		    to the according value.#		 3) These functions expect to find the two files#		    '\${nthost}/WIN40/\${nthost}-enumdrivers3list-WIN40.txt' and#		    '\${nthost}/W32X86/\${nthost}-enumdrivers3list-NTx86.txt' to#		    work on.## WHAT IT DOES: These functions dissect the '$nthost/enumdrivers3list.txt' #		(using "sed", "cat", "awk" and "grep"). They split the input #		files up into individual files representing driver(version)s and#		create appropriate subdirectories for each driver and version #		underneath './\$nthost/<architecture>'. They use the drivernames#		(including spaces) for the directory names. ("/" -- slashes -- #		in drivernames are converted to underscores).## IF IT DOESN'T WORK: The function "fetchenumdrivers3listfromNThost" and #		      consecutive ones may not have been run successfully. This#		      is a precondition for the current function.## HINT: You currently have defined: 'nthost'=\"$nthost\", which resolves above#	mentioned paths to:#		     - '\${nthost}/WIN40/\${nthost}-enumdrivers3list-NTx86.txt'#		     - '\${nthost}/W32X86/\${nthost}-enumdrivers3list-NTx86.txt'# #################################################################################           ............PRESS \"q\" TO QUIT............" \|less}               # -----------------------------------------------------------------------------function makesubdirsforWIN40driverlist(){	if stringinstring help $@ ; thenhelpwithmakesubdirsforWIN40driverlist ;else	cat ${nthost}/WIN40/${nthost}-enumdrivers3list-WIN40.txt \	| grep "Driver Name:" \	| awk -F "[" '{ print $2 }' \	| awk -F "]" '{ print $1 }' \	| sort -f \	| uniq \	| tr / _ \	| sed -e 's/$/\"/' \	| sed -e 's/^/mkdir -p '"\"${nthost}"'\/WIN40\//' \	| tee \	${nthost}/makesubdirsforWIN40driverlist.txt;		sh -x ${nthost}/makesubdirsforWIN40driverlist.txt;#	rm ${nthost}/makesubdirsforWIN40driverlist.txt;fi}# -----------------------------------------------------------------------------# ---------- Make subdirs in ./${sambahost}/W32X86/ for each driver.... -------# -----------------------------------------------------------------------------#function makesubdirsforW32X86driverlist(){	if stringinstring help $@ ; thenhelpwithvampiredrivers ;else	cat ${nthost}/W32X86/${nthost}-enumdrivers3list-NTx86.txt \	| grep "Driver Name:" \	| awk -F "[" '{ print $2 }' \	| awk -F "]" '{ print $1 }' \	| sort -f \

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -