
कोबाल्ट स्ट्राइक मैलिएबल C2 प्रोफाइल के लिए पायथन इंटरप्रेटर। आपको उन्हें प्रोग्रामेटिक रूप से पार्स करने, बनाने और संशोधित करने की अनुमति देता है।
Cobalt Strike Malleable C2 प्रोफाइल के लिए एक Python इंटरप्रेटर, जो आपको उन्हें पार्स करने, संशोधित करने, प्रोग्रामेटिक रूप से बनाने और सिंटैक्स को मान्य करने की अनुमति देता है।
Cobalt Strike संस्करण 4.3 से शुरू होने वाले सभी Cobalt Strike Malleable C2 Profile व्याकरण का समर्थन करता है।
यह पिछले Cobalt Strike रिलीज़ के साथ बैकवर्ड संगत नहीं है।
pyMalleableC2 और इस प्रकृति के अन्य प्रोजेक्ट्स के बीच क्या अंतर हैं?
if स्टेटमेंट के रूप में AI है।pyMalleableC2 को Python 3.9 का उपयोग करके बनाया गया था, हालांकि यह Python 3.6 तक बैकवर्ड संगत होना चाहिए।
Pip का उपयोग करके इंस्टॉल करें:
pip3 install pymalleablec2pyMalleableC2 आपको एक सहमतिपूर्ण वयस्क मानता है और मानता है कि आप जानते हैं कि Malleable C2 प्रोफाइल कैसे लिखे जाते हैं। यह सिंटैक्स त्रुटियों का पता लगाने में सक्षम है, हालांकि कोई रनटाइम जाँच लागू नहीं की गई है। यदि ऐसा निर्देश दिया जाए तो यह खुशी-खुशी ऐसे प्रोफाइल उत्पन्न करेगा जो वास्तव में प्रोडक्शन में काम नहीं करते। प्रोडक्शन में उपयोग करने से पहले हमेशा उत्पन्न प्रोफाइल को c2lint के माध्यम से चलाएं!
(तकनीकी रूप से आप इस लाइब्रेरी का उपयोग करके c2lint का Python संस्करण बना सकते हैं, *cough* PR स्वागत है *cough*)
pyMalleableC2 का प्राथमिक लेखक Marcello Salvati है।
Twitter: @byt3bl33d3r, Github: @byt3bl33d3r
(अधिक उदाहरणों के लिए examples फ़ोल्डर देखें)
एक फ़ाइल में स्थित Malleable C2 प्रोफाइल के लिए AST उत्पन्न करें, फिर AST से स्रोत कोड का पुनर्निर्माण करें:
from malleablec2 import Profile
# Parse a profile given its path
p = Profile.from_file("amazon.profile")
# Print the generated AST
print(p.ast.pretty())
# Reconstruct source code from the AST and print to console
print(p.reconstruct())
# Shortcut for the above :)
print(p)
एक 'इनलाइन' Malleable C2 प्रोफाइल के लिए AST उत्पन्न करें, फिर AST से स्रोत कोड का पुनर्निर्माण करें:
code = '''
set jitter "0";
set sleeptime "3000";
http-get {
set uri "/wow/this/is/cool";
}
http-post {
set uri "/pymalleablec2/is/the/shit";
}
'''
# Parse a profile from a string
p = Profile.from_string(code)
# Print the generated AST
print(p.ast.pretty())
# Reconstruct source code from the AST and print to console
print(p)
एक Malleable C2 प्रोफाइल को शुरू से प्रोग्रामेटिक रूप से बनाएं:
from malleablec2 import Profile
from malleablec2.components import *
# Create an empty profile
p = Profile.from_scratch()
# Set some global options
p.set_option("sleeptime", "0")
p.set_option("jitter", "0")
p.set_option("pipename", "mojo__##")
# Create an http-get block
http_get = HttpGetBlock()
# Set the uri http-get option
http_get.set_option("uri", "/wat/a/tease")
# Create a client block
client = ClientBlock()
# Add a header statement to the client block
client.add_statement("header", "Accept", "*/*")
# Create a server block
server = ServerBlock()
# Add the client and server blocks to the http-get block
http_get.add_code_block(client)
http_get.add_code_block(server)
# Create a http-post block
http_post = HttpPostBlock()
# Set the uri http-post option
http_post.set_option("uri", "/wat/ucraycray")
# Add the http-get and http-post blocks to the profile
p.add_code_block(http_get)
p.add_code_block(http_post)
# Reconstruct source code from the generated AST and print to console
print(p)
एक बहुत ही सरल उदाहरण जो दर्शाता है कि प्रोग्रामेटिक रूप से Malleable C2 प्रोफाइल को कैसे यादृच्छिक किया जाए:
from malleablec2 import Profile
from malleablec2.randomizer import ProfileRandomizer
from lark import Token
class MyRandomizer(ProfileRandomizer):
# We implement the global_option_set method which will get called on every parsed global option statement in the profile
def global_option_set(self, tree):
option_name = tree.children[0]
if option_name == "pipename":
# "Randomize" the pipename value
tree.children[1].children[0] = Token('ESCAPED_STRING', '"my_random_pipename_##"')
# Parse a profile given its path
p = Profile.from_file("amazon.profile")
r = MyRandomizer()
# Walk through the generated profile AST and apply randomization rules
r.randomize(p)
# Reconstruct source code then output the profile to the console
print(p)