-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathApp.py
More file actions
143 lines (123 loc) · 4.26 KB
/
Copy pathApp.py
File metadata and controls
143 lines (123 loc) · 4.26 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# -*- coding: UTF-8 -*-
import os
import datetime
import time
import subprocess
import sys
# from modules.app import *
#
import re
import time
# with open("C:\\Users\\root\\Desktop\\activity_info.log", "a+") as f:
# # ^ Package:.*
#
# lines = f.readlines()
# components = []
# for line in lines:
# le = line.replace(" ", "").replace("\n", "")
# if le.startswith("Package:"):
# package = le.replace("Package:","")
# print package
# continue
# if not le.startswith("Permission"):
# if not (le.startswith("TargetActivity:") or le.startswith("ParentActivity:")):
# components.append(le)
# else:
# continue
line = "com.huawei.camerakit.impl (HwCameraKit)"
app_name = line[line.rfind('('):line.rfind(')')].replace("(","").replace(")","")
print app_name
# print connect
# mc = re.match(r"\s\s\S.*\s.*\s.*Permission: null")
# print mc.group(0)
# comp = re.compile(r"^\s\s\S.*\s.*\s.*Permission: null")
# comp = re.findall("(\W*)\W*Permission: null",connect)
# comp = re.findall(r"([\S\.]*)\W.*\W*Permission: null",connect)
# for c in comp:
# print c
# print comp
# conts = comp.findall(connect)
# for cont in conts:
# print str(cont).replace("Permission: null","")
# comp = re.match(r'.*\r\nPermission: null', connect)
# print aa
# print connect
# AttackSurface("")
#
# connect = os.popen("adb connect 192.168.43.1")
# print connect.read()
# forward = os.popen("adb forward tcp:41415 tcp:41415")
# print forward.read()
#
#
#
# with open("C:\Users\\root\Desktop\info.log","w+") as f:
# p = subprocess.Popen("drozer console connect --server 192.168.43.1:41415", shell=True, stdin=subprocess.PIPE,stdout=f.fileno(), stderr=subprocess.PIPE)
# resl = f.readline()
# print resl
# p.stdin.write("run app.package.list \n".encode("utf-8"))
# p.stdin.flush()
#
# # !/usr/bin/python
# # -*- coding: UTF-8 -*-
# import os
# import sys
#
# f = open("help.txt", 'w') # 创建文件对象
# sys.stdout_backup = sys.stdout # 先把默认的输出地址备份
# sys.stdout = f # 把输出地址改成f文件对象,下面所有内容都将出现在txt文档里
# sys.stdout = sys.stdout_backup # 把stdout的输出地址再改回来
#
#
# forward = "adb forward tcp:41415 tcp:41415"
# print("xxxxxxxxxxxxxxxxxx")
# # drozer console connect --server 192.168.43.1:41415
#
# print p.pid
#
# # print(p.stdout.read())
# p.stdin.write("run app.package.list \n".encode("utf-8"))
# p.stdin.flush()
# out,err = p.communicate()
# print out,err
#
# p.stdin.write("exit() \n".encode("utf-8"))
# p.stdin.flush()
# # p.wait()
# # p.stdin.write(bytes('print(2) \n'),'utf-8')
# # p.stdin.write(bytes('print(3) \n'),'utf-8')
# out,err = p.communicate()
# print out,err
# subprocess.Popen.communicate(input=None, timeout=None)
# result = p.stdout.readlines()
# for re in result:
# print(re)
# print("xxxxxxx")
# print("====",result)
# p.stdin.write(bytes("list",'utf-8'))
# p.stdin.write(bytes("\n",'utf-8'))
# p.stdin.flush()
# result = p.stdout.readlines()
# print(result)
# res = subprocess.Popen('drozer console connect --server 127.0.0.1:41415',shell=True,stdin=subprocess.PIPE, stdout=subprocess.PIPE,stderr=subprocess.PIPE,close_fds=False)
# list_cmd = "run app.package.list"
# print(res.pid)
# result = res.stdout.readlines()
# print(result)l
# res.stdin.write(bytes(list_cmd,'utf-8'))
# res.stdin.write(bytes("\n",'utf-8'))
# res.stdin.flush()
# result = res.stdout.readlines()
# print(result)
# p = subprocess.Popen("cmd.exe",shell=True,stdin=subprocess.PIPE,stdout=subprocess.PIPE)
# p.stdin.write("echo Hello!".encode("GBK"))
# p.stdin.flush()
# result = p.stdout.readlines()
# print(result)
# res = subprocess.run(['drozer', 'console', 'connect', '--server', '127.0.0.1:41415'],shell=True,stdin=subprocess.PIPE, stdout=subprocess.PIPE,stderr=subprocess.PIPE,timeout=30)
# result = res.stdout.readlines()
# print(result)
temp_root_path ="C:\\Users\\root\\Desktop\\"
pa = os.path.join(temp_root_path, "embedded_ca")
file = open(pa, "w+")
print os.path.getsize(pa)