Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

A doubt about python


  • Please log in to reply
1 reply to this topic

#1 sharly55

sharly55

  • Members
  • 35 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Mexico
  • Local time:05:07 PM

Posted 24 July 2014 - 09:06 AM

Can I execute an file.exe using a script python? I mean you can read and open a text file using "f = open ('file.txt', 'r')" but if I want to execute a file.exe? how I can do this o I can't? because if put "f = open ('file.exe')" the script runs but nothing happen



BC AdBot (Login to Remove)

 


#2 AndroidOS

AndroidOS

    Malware Search++ developer


  • Security Developer
  • 146 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:UK
  • Local time:12:07 AM

Posted 24 July 2014 - 09:10 AM

A simple way to do this is:

 

exec(open("./filename").read())

 

See this page: https://docs.python.org/3.3/whatsnew/3.0.html?highlight=execfile#builtins






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users