Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
IOT-fuzz
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
尹启迪
IOT-fuzz
Commits
e25f0abc
Commit
e25f0abc
authored
Oct 12, 2020
by
张航玮
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new file
parent
8d31643b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
mitmpx.py
mitmpx.py
+53
-0
No files found.
mitmpx.py
0 → 100644
View file @
e25f0abc
import
mitmproxy
class
ProxyLogger
:
def
__init__
(
self
,
request_url
):
self
.
request_url
=
request_url
def
request
(
self
,
flow
):
f
=
open
(
"PROXY_MODE_FILE"
,
'r'
)
mode
=
f
.
readline
()
#Creating template request
print
(
mode
)
if
mode
==
'1'
:
print
(
'REQUEST CAPTURE MODE'
)
headers
=
flow
.
request
.
headers
request
=
flow
.
request
.
get_text
(
strict
=
True
)
# if flow.request.method == 'GET' and \
# '?' not in flow.request.path:
# return
string
+=
flow
.
request
.
method
+
' '
string
+=
flow
.
request
.
path
+
' '
string
+=
flow
.
request
.
http_version
+
'
\n
'
for
k
,
v
in
headers
.
items
():
temp
=
'
%
s
%
s
\n
'
%
(
k
,
v
)
string
=
string
+
temp
# with open("REQUEST_FILE", 'w+') as f:
# f.write(string)
# if len(request) > 0:
# f.write(request + "\n")
def
response
(
self
,
flow
):
f
=
open
(
"PROXY_MODE_FILE"
,
'r'
)
mode
=
f
.
readline
()
#Logging the response status code
if
mode
==
'-1'
:
self
.
normal_log_mode
(
flow
)
self
.
forced_browsing_mode
(
flow
)
def
normal_log_mode
(
self
,
flow
):
status_code
=
str
(
flow
.
response
.
status_code
)[
0
]
#checking first digit of the error code
# if status_code == '4' or status_code == '5': #4xx or 5xx error code received
# fp1 = open(ERROR_FILE, 'a+')
# fp1.write(self.request_url + ' ' + str(flow.response.status_code) + '\n')
# fp1.close()
def
forced_browsing_mode
(
self
,
flow
):
status_code
=
str
(
flow
.
response
.
status_code
)
if
status_code
==
'200'
:
print
(
'DISCLOSURE DETECTED'
)
def
start
():
return
ProxyLogger
(
'placeholder'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment