-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathparseurl.py
More file actions
executable file
·67 lines (54 loc) · 1.94 KB
/
parseurl.py
File metadata and controls
executable file
·67 lines (54 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/python
#11/21/2012 Zhengyang
import os
import json
class FileParseUrl:
def __init__(self,path):
self.path=path
def GetUrl(self,path):
list_dirs = os.walk(path)
for root, dirs, files in list_dirs:
for f in files:
lisyhttp=[]
lisyhttps=[]
filepath=os.path.join(root, f)
#print filepath
if filepath.find(".smali")>=0 or filepath.find(".properties")>=0:
#if filepath.find("AndroidManifest.xml")<0:
file_object=open(filepath)
try:
list_of_all_the_lines = file_object.readlines()
for line in list_of_all_the_lines:
templine=line.lower()
if templine.find("http://")>0:
templine = templine[templine.find("http://") :]
if templine.find("\"")>0:
templine = templine[:templine.find("\"")]
if templine[len(templine)-1]=="\r" or templine[len(templine)-1]=="\n":
templine=templine[:len(templine)-1]
if templine[len(templine)-1]=="\\":
templine=templine[:len(templine)-1]
if templine.find ('schemas.android.com')<0:
lisyhttp.append(templine)
if templine.find("https://")>0:
templine = templine[templine.find("https://") :]
if templine.find("\"")>0:
templine = templine[:templine.find("\"")]
if templine[len(templine)-1]=="\r" or templine[len(templine)-1]=="\n":
templine=templine[:len(templine)-1]
if templine[len(templine)-1]=="\\":
templine=templine[:len(templine)-1]
if templine.find('schemas.android.com')<0:
lisyhttps.append(templine)
if len(lisyhttp)>0 or len(lisyhttps)>0:
print filepath
if len(lisyhttp)>0:
print ("http",lisyhttp)
if len(lisyhttps)>0:
print ("https",lisyhttps)
#print "\n"
finally:
file_object.close()
if __name__=="__main__":
fileparseurl=FileParseUrl("")
fileparseurl.GetUrl("/home/zyqu/Research/Android_sec/aib.ibank.android")