May-09-2018, 07:01 AM
Hello guys:
I wrote a litter program. It can running on linux and windows. But when I packaged it on Windows and run it, the html file could run normally,but when visit the CGI files, the error was happend . The commandline show:
I wrote a litter program. It can running on linux and windows. But when I packaged it on Windows and run it, the html file could run normally,but when visit the CGI files, the error was happend . The commandline show:
Error:192.168.0.21 - - [09/May/2018 14:54:14] "GET /cgi-bin/main.py HTTP/1.1" 200 -
192.168.0.21 - - [09/May/2018 14:54:14] command: D:\damai\server.exe -u D:\damai
\cgi-bin\main.py ""
192.168.0.21 - - [09/May/2018 14:54:15] b'[3976] Failed to execute script server
\r\nTraceback (most recent call last):\r\n File "server.py", line 73, in <modul
e>\r\n welcome()\r\n File "server.py", line 41, in welcome\r\n mod_choice
=str(input("\xc7\xeb\xd1\xa1\xd4\xf1\xa3\xba"))\r\nEOFError: EOF when reading a
line\r\n'
192.168.0.21 - - [09/May/2018 14:54:15] CGI script exit status 0xffffffff
192.168.0.21 - - [09/May/2018 14:54:15] code 404, message File not found
192.168.0.21 - - [09/May/2018 14:54:15] "GET /favicon.ico HTTP/1.1" 404 -
This is the code:def welcome(): print('TIP1!') print('HTTPS://AILS.TOP') print('=='*16) print('TIP2:') print('=='*16) mod_choice=str(input("TIP3:")) if mod_choice=="1": print("TIP4") fullpath=str(input("")) if os.path.isfile(fullpath): add_path(fullpath) qr_url="http://"+ip+":8080/cgi-bin/download.py?filename="+path creatQR(qr_url) else: print(colored("WARNING:TIP5!","yellow")) print() welcome() elif mod_choice=="2": print("TIP6") fullpath=str(input("")) add_path(fullpath) qr_url="http://"+ip+":8080/cgi-bin/main.py" creatQR(qr_url) elif mod_choice=='0': exit() else: print(colored("TIP7!","yellow")) print() welcome() if __name__ == '__main__': try: handler = CGIHTTPRequestHandler handler.cgi_directories = ['/cgi-bin', '/htbin'] port = 8080 server = HTTPServer(('', port), handler) ip=get_host_ip() welcome() webbrowser.open("index.html", new=0, autoraise=True) print(colored("TIP8","yellow")) print() server.serve_forever()Thanks!