[Beginner] - Hanging in the code, can't figure out what's wrong

Loop.IO thisisink01 at gmail.com
Sat Apr 2 17:59:10 EDT 2016


Hey 

So I built a keylogger using python as a test, got the code from the tutorial online, I want to improve on it to make it more automated, but the issue I'm having is it won't create the file until I press return, any clues where I'm going wrong? 

If I press return it makes the batch file, otherwise it just hangs. 

CODE: 

import os 
from os.path import join 

lookfor = "iexplore.exe" 
for root, dirs, files in os.walk('C:\\Program Files\\Internet Explorer'): 
    print "searching", root 
    if lookfor in files: 
        print "found: %s" % join(root, lookfor) 
         
import sys 

def create(): 
    print("creating new file") 

    name=raw_input ('C:\\Documents\\PythonCoding\\')+'launch2.bat' 
                    

    try: 
        file=open(name,'w') 
        file.close() 

    except: 
            print("error occured") 
            sys.exit(0) 

create() 



More information about the Python-list mailing list