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
3a830c88
Commit
3a830c88
authored
Nov 09, 2020
by
张航玮
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new file
parent
7e24f831
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
0 deletions
+74
-0
proxylogger.py
proxylogger.py
+74
-0
No files found.
proxylogger.py
0 → 100644
View file @
3a830c88
import
mitmproxy
n
=
1
def
real_path
(
path
):
print
(
path
)
if
path
==
"/"
:
return
False
elif
path
[
-
3
:]
==
"php"
or
path
[
-
3
:]
==
"cgi"
:
return
True
elif
path
[
-
2
:]
==
"js"
or
path
[
-
3
:]
==
"gif"
or
path
[
-
3
:]
==
"css"
:
return
False
return
True
class
ProxyLogger
:
def
__init__
(
self
,
request_url
):
self
.
request_url
=
request_url
def
request
(
self
,
flow
):
global
n
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
real_path
(
flow
.
request
.
path
):
string
=
"-*-"
+
str
(
n
)
+
"
\n
"
n
=
n
+
1
#print()
# 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
'
print
(
string
)
for
k
,
v
in
headers
.
items
():
#print(k,v)
temp
=
'
%
s
%
s
\n
'
%
(
k
,
v
)
string
=
string
+
temp
string
=
string
+
'
\n
'
with
open
(
"REQUEST_FILE"
,
'a+'
)
as
f
:
f
.
write
(
string
)
print
(
request
)
if
len
(
request
)
>
0
:
f
.
write
(
request
+
'
\n
'
)
f
.
close
()
def
response
(
self
,
flow
):
f
=
open
(
"PROXY_MODE_FILE"
,
'r'
)
mode
=
f
.
readline
()
#Logging the response status code
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