im creating a webpage that will show me the SSID's available in my Network
For this I have use this code:
nm-tool | grep "Infra" | cut -d " " -f5 > /home/nunukene/SSID3.txt
Im saving this into a file called SSID3, to later open it using the open() , read() and str.split
My problem is that the code I want to execute in the page, wont get executed, the file SSID3.txt wont be created
This is my website code so far:
#!/usr/bin/python
import os
import subprocess
import cgitb
cgitb.enable()
a=os.system("""nm-tool | grep "Infra" | cut -d " " -f5 > /home/nunukene/SSID3.txt""")
#SSIDStr = subprocess.check_output('nm-tool | grep "Infra" | cut -d " " -f5-6', shell=True)
#SSIDArray = str.split(SSIDStr)
ID = subprocess.check_output('ls', shell=True)
a='devilman'
print "Content-type:text/html\r\n\r\n"
print "<!DOCTYPE html>"
print "<html>"
print "<title> Not Hacking lol</title>"
print "<body>"
print "<h1> Join %s One of this networks <h1>" %(a)
print "</body>"
print "</html>"
I dont know how to get this process working before the rest!
a reason your subprocess call didn't work is you would need to make a list out of all of the arguments to the command.
SSIDStr = subprocess.check_output(['nm-tool','|','grep','"Infra"','|','cut','-d','" "','-f5'])
(I'm not sure if you have to escape the double-quotes in this string)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.