جنـرال الـهكـر
السٌّمعَة : 4 تاريخ التسجيل : 20/04/2014 الموقع : https://sadam-alsharabi.roo7.biz
| موضوع: متفاعلًا مع الـRegshot .. كود سحب مفاتيح الريجستري المضافة مؤخرًا الأحد مايو 11, 2014 6:51 pm | |
| السلام عليكم ورحمة الله و بركاته الكثير منا يعلم أهمية برنامج الـ Regshot في مراقبة الـ harddisk و Registry البرنامج كما هو معلوم يقوم بتصدير نتائج فحصه إلى ملف نصي اليوم ولله الحمد قمت ببرمجة كود أداة احتجتها عندما تعبت يدي من سحب مفاتيح الريجستري المضافة مؤخرًا بشكل يدوي من الـ Regedit فمهمتها هي قراءة نتائج الـ Regshot وتحويل المفاتيح المضافة إليها إلى أوامر دفعية و تصديرها لملف bat مهمة هذا الملف سحبها وتحويلها إلى example.reg الأداة تقوم بسحب الـ key الجذر المضاف و تتخطى أفرعه إن كان له أفرع الأداة تقوم بتخطي جذر الـ HKU وعدم إضافته للقائمة المصدرة فقط ضع نتيجة الفحص بنفس مجلد الأداة باسم 1.txt صورة توضح فائدة الأداة , و الأسطر الملونة من الصورة لتوضيح مسألة تخطي المكررات الصورة بدقة عالية لضعاف النظر |10| http://img08.arabsh.com/uploads/image/2013/06/20/0c35474d67f402.png الكود - الكود:
-
[LEFT][COLOR="DimGray"] // Author : m0az // Devc++
#include #include #include using namespace std; std::string HKLM = "HKLM"; std::string HKLU = "HKLU"; std::string HKU = "HKU"; std::string HKCR = "HKCR"; std::string HKLmachine = "HKEY_LOCAL_MACHINE"; std::string HKLUser = "HKEY_LOCAL_USER"; std::string HKCRoot = "HKEY_CLASSES_ROOT"; bool Fnd(std::string Original,std::string Search) { int X = Search.length(); int Y = Original.length();
for(int SearchInChars = 0 ; SearchInChars < Y ; SearchInChars++) { int CorrectChars = 0; for( int SearchStringChars = 0 ; SearchStringChars < X ; SearchStringChars++) { if(Original[SearchInChars] == Search[SearchStringChars]){ SearchInChars++; CorrectChars++; }
if(CorrectChars == X) return 1; } } return 0; }
int main(){ ifstream x; ofstream y; x.open("1.txt"); y.open("x.bat"); std::string lastkey; char slash = '\\'; int slashnumber = 0; std::string ibat = "type x.reg > reg.txt"; std::string fbat = "type x.reg >> reg.txt"; y << "@echo off\n"; bool firsttime = 0; while(!x.eof()){ string line; getline(x,line); if(Fnd(line,"Keys added")){ getline(x,line); break; } }
while(!x.eof()){ std::string line; getline(x,line); if(Fnd(line,"----------------------------------")) break; std::string templastkey = lastkey; int tempslashnumber = slashnumber; slashnumber = 0; bool boolean = 0; if(lastkey != ""){ lastkey =""; for (int counter = 0 ; counter < line.length() ;counter++) {
if(slashnumber == tempslashnumber) { lastkey += line[counter]; if(templastkey == lastkey){ slashnumber = tempslashnumber; boolean = true; break; } }else if(line[counter] == '\\'){ slashnumber++; if(slashnumber <= tempslashnumber) lastkey = ""; } }
} if(!boolean){ slashnumber = 0; lastkey = "" ; for(int counter = 0 ; counter < line.length() ; counter++) {
lastkey += line[counter]; if(line[counter] == '\\'){ lastkey = ""; slashnumber++; }
} }
if(!boolean){ if(Fnd(line,HKU)) continue; //if(Fnd(line,HKLM)) http://line.replace(line.find(HKLM),HKLM.length(),HKLmachine); //if(Fnd(line,HKLU)) http://line.replace(line.find(HKLU),HKLU.length(),HKLUser); //if(Fnd(line,HKCR)) http://line.replace(line.find(HKCR),HKCR.length(),HKCRoot);
cout << line << endl; y << "Reg EXPORT \"" << line << "\" " << "registry.reg /y" << endl; y << "type registry.reg >> regedit.reg" <} } x.close(); y.close();
return 0; } [/COLOR][/LEFT] بقي فقط القيام بتشغيل الملف الدفعي على نفس النظام الذي تم اصدار الـ Regshot منه ليتم سحب البيانات | |
|