Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def s_static(value, name=None):
"""
Push a static value onto the current block stack.
:see: Aliases: s_dunno(), s_raw(), s_unknown()
:type value: Raw
:param value: Raw static data
:type name: str
:param name: (Optional, def=None) Specifying a name gives you direct access to a primitive
"""
static = primitives.Static(value, name)
blocks.CURRENT.push(static)
# Connection: close
s_static("Connection"),
s_delim(":"),
s_delim(" "),
s_string("close"),
s_static("\r\n\r\n"),
],
)
OpenHeader = Group(
"HTTP Open Header",
definition=[
# GET / HTTP/1.1\r\n
Static("GET / HTTP/1.1\r\n"),
# Connection: close
Static("Connection"),
Delim(":"),
Delim(" "),
String("open"),
Static("\r\n\r\n"),
],
parsed = parsed.replace(" ", "")
parsed = parsed.replace("\t", "")
parsed = parsed.replace("\r", "")
parsed = parsed.replace("\n", "")
parsed = parsed.replace(",", "")
parsed = parsed.replace("0x", "")
parsed = parsed.replace("\\x", "")
value = b""
while parsed:
pair = parsed[:2]
parsed = parsed[2:]
value += six.int2byte(int(pair, 16))
static = primitives.Static(value, name)
blocks.CURRENT.push(static)
def s_static(value, name=None):
"""
Push a static value onto the current block stack.
:see: Aliases: s_dunno(), s_raw(), s_unknown()
:type value: Raw
:param value: Raw static data
:type name: str
:param name: (Optional, def=None) Specifying a name gives you direct access to a primitive
"""
static = primitives.Static(value, name)
blocks.CURRENT.push(static)
# GET / HTTP/1.1\r\n
s_static("GET / HTTP/1.1\r\n"),
# Connection: close
s_static("Connection"),
s_delim(":"),
s_delim(" "),
s_string("close"),
s_static("\r\n\r\n"),
],
)
OpenHeader = Group(
"HTTP Open Header",
definition=[
# GET / HTTP/1.1\r\n
Static("GET / HTTP/1.1\r\n"),
# Connection: close
Static("Connection"),
Delim(":"),
Delim(" "),
String("open"),
Static("\r\n\r\n"),
],
parsed = parsed.replace(" ", "")
parsed = parsed.replace("\t", "")
parsed = parsed.replace("\r", "")
parsed = parsed.replace("\n", "")
parsed = parsed.replace(",", "")
parsed = parsed.replace("0x", "")
parsed = parsed.replace("\\x", "")
value = b""
while parsed:
pair = parsed[:2]
parsed = parsed[2:]
value += six.int2byte(int(pair, 16))
static = primitives.Static(value, name)
blocks.CURRENT.push(static)
def __init__(self, value, name=None):
"""
Primitive that contains static content.
@type value: str
@param value: Raw static data
@type name: str
@param name: (Optional, def=None) Specifying a name gives you direct access to a primitive
"""
super(Static, self).__init__()
self._fuzz_complete = True
self.fuzzable = False
self._value = self.original_value = value
self.name = name
self.s_type = "static"