Portál AbcLinuxu, 11. května 2025 10:26
#include <stdio.h> #include <qstring.h> /* (c) 2006 --mm This code is under GPL. g++ -I/usr/lib/qt-3.3/include -L/usr/lib/qt-3.3/lib -lqt-mt -o \ sim-uncrypt sim-uncrypt.c ./sim-uncrypt 'encrypted-password' */ // getToken from http://svn.berlios.de/wsvn/sim-im/trunk/sim/cfg.cpp QString getToken(QString &from, char c, bool bUnEscape) { QString res; int i; for (i = 0; i < (int)from.length(); i++){ if (from[i] == c) break; if (from[i] == '\\'){ i++; if (i >= (int)from.length()) break; if (!bUnEscape) res += "\\"; } res += from[i]; } if (i < (int)from.length()){ from = from.mid(i + 1); }else{ from = ""; } return res; } main(int argc, char** argv) { // code from Client::getConfig() // http://svn.berlios.de/wsvn/sim-im/trunk/sim/contacts.cpp // now uncrypt password somehow QString pswd = argv[1]; if (pswd.length() && (pswd[0] == '$')) { pswd = pswd.mid(1); QString new_pswd; unsigned short temp = 0x4345; QString tmp; do { QString sub_str = getToken(pswd, '$',0); temp ^= sub_str.toUShort(0,16); new_pswd += tmp.setUnicodeCodes(&temp,1); temp = sub_str.toUShort(0,16); } while (pswd.length()); printf("%s\n",new_pswd.ascii()); } }
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.