python - User input passed as a variable to subprocess.call -
im trying pass variable program being launched. having issues variable working
here code works until passing of rhost, metasploit takes %rhost
i need pass rhost variable straight after set rhosts . please :)
#!/usr/bin/python import os,sys,re,subprocess rhost=raw_input("enter ipaddress range:") print ("your address range is\n" + rhost + "!") subprocess.call("xterm -e msfconsole -x 'sleep 2; use auxiliary/scanner/discovery/arp_sweep; set rhosts '%rhost'; exploit'",shell=true) end = raw_input('hit enter exit.')
use string format:
"xterm -e msfconsole -x 'sleep 2; use auxiliary/scanner/discovery/arp_sweep; set rhosts '\%{0}'; exploit'".format(rhost)
Comments
Post a Comment