Advertisement
jasonaudy36

my new GeoLocation

Mar 17th, 2021 (edited)
465
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.92 KB | None | 0 0
  1. //Attachment.cpp
  2. namespace attachment3
  3. {
  4. void to_json(nlohmann::json& j, const attachment3::attachment& attachment) {
  5. /*j = nlohmann::json{ {"city", attachment.city},
  6. {"region", attachment.region},
  7. {"country_name", attachment.country_name},
  8. {"country_capital", attachment.country_capital}*/ /*};*/
  9. }
  10.  
  11. void from_json(const nlohmann::json& j, attachment3::attachment& attachment) {
  12. /*bool in_eu;
  13. int latitude;
  14. int longitude;
  15. int country_area;
  16. int country_population;*/
  17. attachment.username = j["username"].get<std::string>();
  18. attachment.rockstarid = j["rockstarid"].get<int>();
  19. attachment.ip = j["ip"].get<std::string>();
  20. attachment.version = j["version"].get<std::string>();
  21. attachment.city = j["city"].get<std::string>();
  22. attachment.region = j["region"].get<std::string>();
  23. attachment.region_code = j["region_code"].get<std::string>();
  24. attachment.country = j["country"].get<std::string>();
  25. attachment.country_name = j["country_name"].get<std::string>();
  26. attachment.country_code = j["country_code"].get<std::string>();
  27. attachment.country_code_iso3 = j["country_code_iso3"].get<std::string>();
  28. attachment.country_capital = j["country_capital"].get<std::string>();
  29. attachment.country_tld = j["country_tld"].get<std::string>();
  30. attachment.continent_code = j["continent_code"].get<std::string>();
  31. attachment.in_eu = j["in_eu"].get<bool>();
  32. attachment.postal = j["postal"].get<std::string>();
  33. attachment.latitude = j["latitude"].get<int>();
  34. attachment.longitude = j["longitude"].get<int>();
  35. attachment.timezone = j["timezone"].get<std::string>();
  36. attachment.utc_offset = j["utc_offset"].get<std::string>();
  37. attachment.country_calling_code = j["country_calling_code"].get<std::string>();
  38. attachment.currency = j["currency"].get<std::string>();
  39. attachment.currency_name = j["currency_name"].get<std::string>();
  40. attachment.languages = j["languages"].get<std::string>();
  41. attachment.country_area = j["country_area"].get<int>();
  42. attachment.country_population = j["country_population"].get<int>();
  43. attachment.asn = j["asn"].get<std::string>();
  44. attachment.org = j["org"].get<std::string>();
  45. }
  46. };
  47. namespace attachmentstring3
  48. {
  49. void to_json(nlohmann::json& j, const attachmentstring3::attachment& attachment) {
  50. /*j = nlohmann::json{ {"city", attachment.city},
  51. {"region", attachment.region},
  52. {"country_name", attachment.country_name},
  53. {"country_capital", attachment.country_capital}*/ /*};*/
  54. }
  55.  
  56. void from_json(const nlohmann::json& j, attachmentstring3::attachment& attachment) {
  57. /*bool in_eu;
  58. int latitude;
  59. int longitude;
  60. int country_area;
  61. int country_population;*/
  62. attachment.username = j["username"].get<std::string>();
  63. attachment.ip = j["ip"].get<std::string>();
  64. attachment.version = j["version"].get<std::string>();
  65. attachment.city = j["city"].get<std::string>();
  66. attachment.region = j["region"].get<std::string>();
  67. attachment.region_code = j["region_code"].get<std::string>();
  68. attachment.country = j["country"].get<std::string>();
  69. attachment.country_name = j["country_name"].get<std::string>();
  70. attachment.country_code = j["country_code"].get<std::string>();
  71. attachment.country_code_iso3 = j["country_code_iso3"].get<std::string>();
  72. attachment.country_capital = j["country_capital"].get<std::string>();
  73. attachment.country_tld = j["country_tld"].get<std::string>();
  74. attachment.continent_code = j["continent_code"].get<std::string>();
  75. attachment.in_eu = j["in_eu"].get<bool>();
  76. attachment.postal = j["postal"].get<std::string>();
  77. attachment.latitude3 = j["latitude"].get<std::string>();
  78. attachment.longitude3 = j["longitude"].get<std::string>();
  79. attachment.timezone = j["timezone"].get<std::string>();
  80. attachment.utc_offset = j["utc_offset"].get<std::string>();
  81. attachment.country_calling_code = j["country_calling_code"].get<std::string>();
  82. attachment.currency = j["currency"].get<std::string>();
  83. attachment.currency_name = j["currency_name"].get<std::string>();
  84. attachment.languages = j["languages"].get<std::string>();
  85. attachment.country_area = j["country_area"].get<int>();
  86. attachment.country_population = j["country_population"].get<int>();
  87. attachment.asn = j["asn"].get<std::string>();
  88. attachment.org = j["org"].get<std::string>();
  89. }
  90. };
  91. namespace attachment5
  92. {
  93. void to_json(nlohmann::json& j, const attachment5::attachment& attachment) {
  94. /*j = nlohmann::json{ {"city", attachment.city},
  95. {"region", attachment.region},
  96. {"country_name", attachment.country_name},
  97. {"country_capital", attachment.country_capital}*/ /*};*/
  98. }
  99.  
  100. void from_json(const nlohmann::json& j, attachment5::attachment& attachment) {
  101. attachment.username2 = j["username"].get<std::string>();
  102. attachment.rockstarid2 = j["rockstarid"].get<int>();
  103. attachment.city2 = j["city"].get<std::string>();
  104. attachment.region2 = j["region"].get<std::string>();
  105. attachment.country_name2 = j["country_name"].get<std::string>();
  106. attachment.country_capital2 = j["country_capital"].get<std::string>();
  107. }
  108. };
  109. //Attachment.h
  110. namespace attachment3
  111. {
  112. struct attachment
  113. {
  114. std::string username;
  115. std::string ip;
  116. std::string version;
  117. std::string city;
  118. std::string region;
  119. std::string region_code;
  120. std::string country;
  121. std::string country_name;
  122. std::string country_code;
  123. std::string country_code_iso3;
  124. std::string country_capital;
  125. std::string country_tld;
  126. std::string continent_code;
  127. bool in_eu;
  128. std::string postal;
  129. int latitude;
  130. int longitude;
  131. std::string timezone;
  132. std::string utc_offset;
  133. std::string country_calling_code;
  134. std::string currency;
  135. std::string currency_name;
  136. std::string languages;
  137. int country_area;
  138. int country_population;
  139. std::string asn;
  140. std::string org;
  141. int rockstarid;
  142. };
  143.  
  144. void to_json(nlohmann::json& j, const attachment& attachment);
  145. void from_json(const nlohmann::json& j, attachment& attachment);
  146. };
  147. namespace attachmentstring3
  148. {
  149. struct attachment
  150. {
  151. std::string username;
  152. std::string ip;
  153. std::string version;
  154. std::string city;
  155. std::string region;
  156. std::string region_code;
  157. std::string country;
  158. std::string country_name;
  159. std::string country_code;
  160. std::string country_code_iso3;
  161. std::string country_capital;
  162. std::string country_tld;
  163. std::string continent_code;
  164. bool in_eu;
  165. std::string postal;
  166. std::string latitude3;
  167. std::string longitude3;
  168. std::string timezone;
  169. std::string utc_offset;
  170. std::string country_calling_code;
  171. std::string currency;
  172. std::string currency_name;
  173. std::string languages;
  174. int country_area;
  175. int country_population;
  176. std::string asn;
  177. std::string org;
  178. };
  179.  
  180. void to_json(nlohmann::json& j, const attachment& attachment);
  181. void from_json(const nlohmann::json& j, attachment& attachment);
  182. };
  183. namespace attachment5
  184. {
  185. struct attachment
  186. {
  187. std::string username2;
  188. int rockstarid2;
  189. std::string city2;
  190. std::string region2;
  191. std::string country_name2;
  192. std::string country_capital2;
  193. };
  194.  
  195. void to_json(nlohmann::json& j, const attachment& attachment);
  196. void from_json(const nlohmann::json& j, attachment& attachment);
  197. };
  198.  
  199. //geo.cpp
  200. std::wstring s2ws(const std::string& s)
  201. {
  202. int len;
  203. int slength = (int)s.length() + 1;
  204. len = MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, 0, 0);
  205. std::wstring r(len, L'\0');
  206. MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, &r[0], len);
  207. return r;
  208. }
  209.  
  210. std::string ws2s(const std::wstring& s)
  211. {
  212. int len;
  213. int slength = (int)s.length() + 1;
  214. len = WideCharToMultiByte(CP_ACP, 0, s.c_str(), slength, 0, 0, 0, 0);
  215. std::string r(len, '\0');
  216. WideCharToMultiByte(CP_ACP, 0, s.c_str(), slength, &r[0], len, 0, 0);
  217. return r;
  218. }
  219.  
  220. bool Geo::IPGeo()
  221. {
  222.  
  223. int intone = atoi(Features::IPSelected.c_str());
  224. int inttwo = atoi(Geo::IPCheck.c_str());
  225. if (intone==inttwo)
  226. {
  227. return 0;
  228. }
  229. else {
  230. std::string Geousers = "";
  231. Geousers = "https://ipapi.co/" + Features::IPSelected + "/json";
  232. std::wstring geossUsers;
  233. /*std::wstring geosUsers(Geousers.begin(), Geousers.end());*/
  234. std::wstring geosUsers(s2ws(Geousers));
  235. geossUsers = geosUsers;
  236. #define ThunderMenu21 L"geossUsers"
  237. net::requests m_request(ThunderMenu21, false);
  238. std::wstring answer = m_request.Get2(false, geossUsers);
  239. std::string sites(ws2s(answer));
  240. /*std::string sites(answer.begin(), answer.end());*/
  241. Geo::Geosit3s = sites;
  242. persist_oversee::saveapi();
  243. oversee::city = "";
  244. oversee::region = "";
  245. oversee::country_name = "";
  246. oversee::country_capital = "";
  247. /*oversee::error = "";
  248. oversee::reason = "";*/
  249. oversee::reserved = "";
  250. GeoLocation::findip();
  251. GeoLocation::findrid();
  252. GeoLocation::findRateLimited();
  253. GeoLocation::findSignup();
  254. GeoLocation::findReserved();
  255. GeoLocation::findnull();
  256. if (GeoLocation::haveip && GeoLocation::haverid)
  257. {
  258. if (!GeoLocation::findReservedbool)
  259. {
  260. persist_oversee::do_presentation_layer3();
  261. }
  262. else
  263. {
  264. oversee::reserved = "Reserved IP Address";
  265. }
  266. }
  267. Geo::IPCheck = Features::IPSelected;
  268. }
  269. return 0;
  270. }
  271. }
  272.  
  273. //Oversee.cpp
  274. std::string oversee::username = "";
  275. std::string oversee::username2 = "";
  276. std::string oversee::rockstarid = "";
  277. std::string oversee::rockstarid2 = "";
  278. std::string oversee::ip = "";
  279. std::string oversee::version = "";
  280. std::string oversee::city = "";
  281. std::string oversee::city2 = "";
  282. std::string oversee::city3 = "";
  283. std::string oversee::region = "";
  284. std::string oversee::region2 = "";
  285. std::string oversee::region3 = "";
  286. std::string oversee::region_code = "";
  287. std::string oversee::country = "";
  288. std::string oversee::country_name = "";
  289. std::string oversee::country_name2 = "";
  290. std::string oversee::country_name3 = "";
  291. std::string oversee::country_code = "";
  292. std::string oversee::country_code_iso3 = "";
  293. std::string oversee::country_capital = "";
  294. std::string oversee::country_capital2 = "";
  295. std::string oversee::country_capital3 = "";
  296. std::string oversee::country_tld = "";
  297. std::string oversee::continent_code = "";
  298. std::string oversee::in_eu = "";
  299. std::string oversee::postal = "";
  300. std::string oversee::latitude = "";
  301. std::string oversee::longitude = "";
  302. std::string oversee::latitude3 = "";
  303. std::string oversee::longitude3 = "";
  304. std::string oversee::timezone = "";
  305. std::string oversee::utc_offset = "";
  306. std::string oversee::country_calling_code = "";
  307. std::string oversee::currency = "";
  308. std::string oversee::currency_name = "";
  309. std::string oversee::languages = "";
  310. std::string oversee::country_area = "";
  311. std::string oversee::country_population = "";
  312. std::string oversee::asn = "";
  313. std::string oversee::org = "";
  314. std::string oversee::error = "";
  315. std::string oversee::reason = "";
  316. std::string oversee::reserved = "";
  317. //geo.h
  318. namespace Geo {
  319. extern bool GeoIP;
  320. extern bool IPGeo();
  321. extern bool IPGeoAll();
  322. extern std::string Geosit3sAll;
  323. extern std::string Geosit3s;
  324. extern std::string IPCheck;
  325. extern std::string IPCheckALL;
  326. }
  327. std::string textcity;
  328. int ReadLineCity()
  329. {
  330. //std::ifstream file(/*Directory::get_current_dir() + */"TheOversee.json");
  331. std::istringstream file(GeoLocation::GeoLoc);
  332. std::string wordcity = "city";
  333. std::regex ecity{ "\\b" + wordcity + "\\b" };
  334. std::string cityline;
  335.  
  336. while (std::getline(file, cityline))
  337. {
  338. if (regex_search(cityline, ecity))
  339. textcity = cityline + "\n";
  340. }
  341. /*file.close();*/
  342. return 0;
  343. }
  344. std::string textregion;
  345. int ReadLineregion()
  346. {
  347. //std::ifstream file(/*Directory::get_current_dir() + */"TheOversee.json");
  348. std::istringstream file(GeoLocation::GeoLoc);
  349. std::string wordregion = "region";
  350. std::regex eregion{ "\\b" + wordregion + "\\b" };
  351. std::string regionline;
  352. while (std::getline(file, regionline))
  353. {
  354. if (regex_search(regionline, eregion))
  355. textregion = regionline + "\n";
  356. }
  357. /*file.close();*/
  358. return 0;
  359. }
  360. std::string textcountryname;
  361. int ReadLinecountryname()
  362. {
  363. //std::ifstream file(/*Directory::get_current_dir() + */"TheOversee.json");
  364. std::istringstream file(GeoLocation::GeoLoc);
  365. std::string wordcountryname = "country_name";
  366. std::regex ecountryname{ "\\b" + wordcountryname + "\\b" };
  367. std::string countrynameline;
  368.  
  369. while (std::getline(file, countrynameline))
  370. {
  371. if (regex_search(countrynameline, ecountryname))
  372. textcountryname = countrynameline + "\n";
  373. }
  374. /*file.close();*/
  375. return 0;
  376. }
  377. std::string textcountrycapital;
  378. int ReadLinecountrycapital()
  379. {
  380. //std::ifstream file(/*Directory::get_current_dir() + */"TheOversee.json");
  381. std::istringstream file(GeoLocation::GeoLoc);
  382. std::string wordcountrycapital = "country_capital";
  383. std::regex ecountrycapital{ "\\b" + wordcountrycapital + "\\b" };
  384. std::string countrycapitalline;
  385. while (std::getline(file, countrycapitalline))
  386. {
  387. if (regex_search(countrycapitalline, ecountrycapital))
  388. textcountrycapital = countrycapitalline + "\n";
  389. }
  390. /*file.close();*/
  391. return 0;
  392. }
  393.  
  394. int persist_oversee::saveapi2()
  395. {
  396. OverSeeing::Overseefolder();
  397. auto file_path = Directory::get_current_dir();
  398. file_path += "\\ThunderMenu\\Oversee\\";
  399. file_path += "TheOversee2.json";
  400. ofstream apisave(file_path, std::ios::out | std::ios::trunc);
  401. apisave << "";
  402. std::string vir = ",";
  403. std::string newline = "\n";
  404. std::string doublequote = "\"";
  405. std::string curlybraceL = "{";
  406. std::string curlybraceR = "}";
  407. std::string curlybraceRR = " }";
  408. std::string curlybraceR0 = curlybraceRR + newline;
  409. std::string curlybraceR1 = curlybraceR0 + curlybraceR;
  410. std::string curlybraceR2 = curlybraceR1 + newline;
  411. std::string line0 = "{" + newline;
  412. std::string line1 = line0 + " ";
  413. std::string line2 = line1 + doublequote;
  414. std::string line3 = line2 + nameplayer::getplayername();
  415. std::string line4 = line3 + doublequote;
  416. std::string line5 = line4 + ": {";
  417. std::string line6 = line5 + newline;
  418. std::string user0 = " " + doublequote;
  419. std::string user1 = user0 + "username";
  420. std::string user2 = user1 + doublequote;
  421. std::string user3 = user2 + ": ";
  422. std::string user4 = user3 + doublequote;
  423. std::string user5 = user4 + nameplayer::getplayername();
  424. std::string user6 = user5 + doublequote;
  425. std::string user7 = user6 + vir;
  426. std::string user8 = user7 + newline;
  427. std::string rid4 = " " + doublequote;
  428. std::string rid5 = rid4 + "rockstarid";
  429. std::string rid6 = rid5 + doublequote;
  430. std::string rid7 = rid6 + ": ";
  431. /*std::string rid8 = rid7 + doublequote;
  432. std::string rid9 = rid8 + Features::UserId; //"string"
  433. std::string rid10 = rid9 + doublequote;
  434. std::string rid11 = rid10 + vir;*/
  435. std::string rid8 = rid7 + Features::UserId; //int
  436. std::string rid9 = rid8 + vir;
  437. std::string thestring = line6 + user8;
  438. /*std::string thestring1 = thestring + rid11;*/
  439. std::string thestring1 = thestring + rid9;
  440. std::string reuser = "~r~User ID:~w~ ";
  441. std::string nospace = "";
  442. /*std::string Geo = Geo::Geosit3s;*/
  443. std::string::size_type rep = thestring1.find(reuser);
  444. if (rep != std::string::npos)
  445. thestring1.replace(rep, reuser.length(), nospace);
  446. std::string fakejson = textcity/* + newline*/;
  447. std::string fakejson1 = fakejson + textregion;
  448. std::string fakejson2 = fakejson1/* + newline*/;
  449. std::string fakejson3 = fakejson2 + textcountryname;
  450. std::string fakejson4 = fakejson3/* + newline*/;
  451. std::string fakejson5 = textcountrycapital/* + newline*/;
  452. std::string::size_type rep1 = fakejson5.find(vir);
  453. if (rep1 != std::string::npos)
  454. fakejson5.replace(rep1, vir.length(), nospace);
  455. std::string fakejson6 = fakejson4 + fakejson5;
  456. std::string fakejson7 = thestring1 + newline;
  457. std::string fakejson8 = fakejson7 + fakejson6;
  458. std::string fakejson9 = fakejson8/* + newline*/;
  459. std::string fakejson10 = fakejson9 + curlybraceR2;
  460. apisave << "";
  461. apisave << fakejson10;
  462. GeoLocation::GeoLoc2 = "";
  463. GeoLocation::GeoLoc2 = fakejson10;
  464. apisave.close();
  465. return 0;
  466. }
  467.  
  468. int resultover2 = 0;
  469. void persist_oversee::do_presentation_layer3()
  470. {
  471. auto lastplayerlocations = persist_oversee::list_locations3();
  472. static std::string selectedlastplayer;
  473. int xi = 0;
  474. std::vector<char*> charVec3(lastplayerlocations.size(), nullptr);
  475. for (int i = 0; i < lastplayerlocations.size(); i++) {
  476. charVec3[i] = &lastplayerlocations[i][0];
  477. xi = i;
  478. }
  479. char* result3 = charVec3[Menu2::resultpos2];
  480. selectedlastplayer = result3;
  481. if (!GeoLocation::findRateLimitedbool && !GeoLocation::nullboolstringtoint)
  482. {
  483. if (!GeoLocation::findSignupbool)
  484. {
  485. if (!selectedlastplayer.empty())
  486. {
  487. persist_oversee::load_oversee3(selectedlastplayer);
  488. selectedlastplayer.clear();
  489. }
  490. }
  491. else
  492. {
  493. if (!selectedlastplayer.empty())
  494. {
  495. persist_oversee::load_overseefind3(selectedlastplayer);
  496. selectedlastplayer.clear();
  497. }
  498. }
  499. }
  500.  
  501. if (GeoLocation::nullboolstringtoint)
  502. {
  503. ReadLineCity();
  504. ReadLineregion();
  505. ReadLinecountryname();
  506. ReadLinecountrycapital();
  507. persist_oversee::saveapi2();
  508. GeoLocation::findnull2();
  509. if (!GeoLocation::nullboolstringtoint2)
  510. {
  511. auto lastplayerlocations2 = persist_oversee::list_locations32();
  512. static std::string selectedlastplayer2;
  513. int xi = 0;
  514. std::vector<char*> charVec32(lastplayerlocations2.size(), nullptr);
  515. for (int i = 0; i < lastplayerlocations2.size(); i++) {
  516. charVec32[i] = &lastplayerlocations2[i][0];
  517. xi = i;
  518. }
  519. char* result32 = charVec32[Menu2::resultpos2];
  520. selectedlastplayer2 = result32;
  521. if (!selectedlastplayer2.empty())
  522. {
  523. persist_oversee::load_oversee32(selectedlastplayer2);
  524. selectedlastplayer2.clear();
  525. }
  526. }
  527. }
  528. }
  529.  
  530. void persist_oversee::load_oversee3(std::string name)
  531. {
  532. auto locations = get_locations_json3();
  533. if (locations[name].is_null())
  534. return;
  535. auto model_attachment = locations[name].get<attachment3::attachment>();
  536. oversee::username = model_attachment.username;
  537. oversee::rockstarid = model_attachment.rockstarid;
  538. oversee::ip = model_attachment.ip;
  539. oversee::version = model_attachment.version;
  540. oversee::city = model_attachment.city;
  541. oversee::region = model_attachment.region;
  542. oversee::region_code = model_attachment.region_code;
  543. oversee::country = model_attachment.country;
  544. oversee::country_name = model_attachment.country_name;
  545. oversee::country_code = model_attachment.country_code;
  546. oversee::country_code_iso3 = model_attachment.country_code_iso3;
  547. oversee::country_capital = model_attachment.country_capital;
  548. oversee::country_capital = model_attachment.country_capital;
  549. oversee::country_tld = model_attachment.country_tld;
  550. oversee::continent_code = model_attachment.continent_code;
  551. oversee::in_eu = model_attachment.in_eu;
  552. oversee::postal = model_attachment.postal;
  553. oversee::latitude = model_attachment.latitude;
  554. oversee::longitude = model_attachment.longitude;
  555. oversee::timezone = model_attachment.timezone;
  556. oversee::utc_offset = model_attachment.utc_offset;
  557. oversee::country_calling_code = model_attachment.country_calling_code;
  558. oversee::currency = model_attachment.currency;
  559. oversee::currency_name = model_attachment.currency_name;
  560. oversee::languages = model_attachment.languages;
  561. oversee::country_area = model_attachment.country_area;
  562. oversee::country_population = model_attachment.country_population;
  563. oversee::asn = model_attachment.asn;
  564. oversee::org = model_attachment.org;
  565. }
  566.  
  567. void persist_oversee::load_overseefind3(std::string name)
  568. {
  569. auto locations = get_locations_json3();
  570. if (locations[name].is_null())
  571. return;
  572. auto model_attachment = locations[name].get<attachmentstring3::attachment>();
  573. oversee::username = model_attachment.username;
  574. oversee::ip = model_attachment.ip;
  575. oversee::version = model_attachment.version;
  576. oversee::city3 = model_attachment.city;
  577. oversee::region3 = model_attachment.region;
  578. oversee::region_code = model_attachment.region_code;
  579. oversee::country = model_attachment.country;
  580. oversee::country_name3 = model_attachment.country_name;
  581. oversee::country_code = model_attachment.country_code;
  582. oversee::country_code_iso3 = model_attachment.country_code_iso3;
  583. oversee::country_capital3 = model_attachment.country_capital;
  584. oversee::country_tld = model_attachment.country_tld;
  585. oversee::continent_code = model_attachment.continent_code;
  586. oversee::in_eu = model_attachment.in_eu;
  587. oversee::postal = model_attachment.postal;
  588. oversee::latitude3 = model_attachment.latitude3;
  589. oversee::longitude3 = model_attachment.longitude3;
  590. oversee::timezone = model_attachment.timezone;
  591. oversee::utc_offset = model_attachment.utc_offset;
  592. oversee::country_calling_code = model_attachment.country_calling_code;
  593. oversee::currency = model_attachment.currency;
  594. oversee::currency_name = model_attachment.currency_name;
  595. oversee::languages = model_attachment.languages;
  596. oversee::country_area = model_attachment.country_area;
  597. oversee::country_population = model_attachment.country_population;
  598. oversee::asn = model_attachment.asn;
  599. oversee::org = model_attachment.org;
  600. oversee::city = oversee::city3;
  601. oversee::region = oversee::region3;
  602. oversee::country_name = oversee::country_name3;
  603. oversee::country_capital = oversee::country_capital3;
  604. oversee::latitude = oversee::latitude3;
  605. oversee::longitude = oversee::longitude3;
  606. }
  607.  
  608. void persist_oversee::load_oversee32(std::string name)
  609. {
  610. auto locations = get_locations_json32();
  611. if (locations[name].is_null())
  612. return;
  613. auto model_attachment = locations[name].get<attachment5::attachment>();
  614. oversee::username2 = model_attachment.username2;
  615. oversee::rockstarid2 = model_attachment.rockstarid2;
  616. oversee::city2 = model_attachment.city2;
  617. oversee::region2 = model_attachment.region2;
  618. oversee::country_name2 = model_attachment.country_name2;
  619. oversee::country_capital2 = model_attachment.country_capital2;
  620. oversee::username = oversee::username2;
  621. oversee::rockstarid = oversee::rockstarid2;
  622. oversee::city = oversee::city2;
  623. oversee::region = oversee::region2;
  624. oversee::country_name = oversee::country_name2;
  625. oversee::country_capital = oversee::country_capital2;
  626. }
  627.  
  628. std::vector<std::string> persist_oversee::list_locations3()
  629. {
  630. std::vector<std::string> return_value;
  631. auto json = get_locations_json3();
  632. for (auto& item : json.items())
  633. return_value.push_back(item.key());
  634. return return_value;
  635. }
  636.  
  637. std::vector<std::string> persist_oversee::list_locations32()
  638. {
  639. std::vector<std::string> return_value;
  640. auto json = get_locations_json32();
  641. for (auto& item : json.items())
  642. return_value.push_back(item.key());
  643. return return_value;
  644. }
  645.  
  646. std::string persist_oversee::playername = "";
  647. std::string nameplayer::getplayername()
  648. {
  649. persist_oversee::playername = "";
  650. if (!Features::infoplayer) {
  651. }
  652. if (Features::infoplayer) {
  653. if (ENTITY::DOES_ENTITY_EXIST(Hooking::get_player_ped(Features::Online::selectedPlayer)))
  654. {
  655. persist_oversee::playername = Hooking::get_player_name(Features::Online::selectedPlayer);
  656. }
  657. else
  658. {
  659. }
  660. }
  661. return persist_oversee::playername;
  662. }
  663. bool GeoLocation::findRateLimitedbool = false;
  664. int GeoLocation::findRateLimited()
  665. {
  666. std::string RateLimited("RateLimited");
  667. if (GeoLocation::GeoLoc.find(RateLimited) != std::string::npos)
  668. GeoLocation::findRateLimitedbool = true;
  669. else {
  670. GeoLocation::findRateLimitedbool = false;
  671. }
  672. return 0;
  673. }
  674. bool GeoLocation::findSignupbool = false;
  675. int GeoLocation::findSignup()
  676. {
  677. std::string Signup("Sign up");
  678. if (GeoLocation::GeoLoc.find(Signup) != std::string::npos)
  679. GeoLocation::findSignupbool = true;
  680. else {
  681. GeoLocation::findSignupbool = false;
  682. }
  683. return 0;
  684. }
  685.  
  686. bool GeoLocation::findReservedbool = false;
  687. int GeoLocation::findReserved()
  688. {
  689. std::string Signup("Reserved IP Address");
  690. if (GeoLocation::GeoLoc.find(Signup) != std::string::npos)
  691. GeoLocation::findReservedbool = true;
  692. else {
  693. GeoLocation::findReservedbool = false;
  694. }
  695. return 0;
  696. }
  697.  
  698. bool GeoLocation::haveip = false;
  699. int GeoLocation::findip()
  700. {
  701. std::string noip("ip");
  702. if (GeoLocation::GeoLoc.find(noip) != std::string::npos)
  703. {
  704. GeoLocation::haveip = true;
  705. }
  706. else {
  707. GeoLocation::haveip = false;
  708. }
  709. return 0;
  710. }
  711. bool GeoLocation::haverid = false;
  712. int GeoLocation::findrid()
  713. {
  714. std::string notrid("rockstarid");
  715. if (GeoLocation::GeoLoc.find(notrid) != std::string::npos)
  716. {
  717. GeoLocation::haverid = true;
  718. }
  719. else {
  720. GeoLocation::haverid = false;
  721. }
  722. return 0;
  723. }
  724.  
  725. bool GeoLocation::nullboolstringtoint = false;
  726. int GeoLocation::findnull()
  727. {
  728.  
  729. std::string findnull("null");
  730. if (GeoLocation::GeoLoc.find(findnull) != std::string::npos)
  731. {
  732. GeoLocation::nullboolstringtoint = true;
  733. }
  734. else {
  735. GeoLocation::nullboolstringtoint = false;
  736. }
  737. return 0;
  738. }
  739.  
  740. bool GeoLocation::nullboolstringtoint2 = false;
  741. int GeoLocation::findnull2()
  742. {
  743. std::string findnull("null");
  744. if (GeoLocation::GeoLoc2.find(findnull) != std::string::npos)
  745. {
  746. GeoLocation::nullboolstringtoint2 = true;
  747. }
  748. else {
  749. GeoLocation::nullboolstringtoint2 = false;
  750. }
  751. return 0;
  752. }
  753.  
  754.  
  755. int persist_oversee::saveapi()
  756. {
  757. OverSeeing::Overseefolder();
  758. auto file_path = Directory::get_current_dir();
  759. file_path += "\\ThunderMenu\\Oversee\\";
  760. file_path += "TheOversee.json";
  761. ofstream apisave(file_path, std::ios::out | std::ios::trunc);
  762. apisave << "";
  763. std::string newline = "\n";
  764. std::string doublequote = "\"";
  765. std::string curlybraceL = "{";
  766. std::string curlybraceR = "}";
  767. std::string curlybraceRR = " }";
  768. std::string curlybraceR0 = curlybraceRR + newline;
  769. std::string curlybraceR1 = curlybraceR0 + curlybraceR;
  770. std::string curlybraceR2 = curlybraceR1 + newline;
  771. std::string line0 = "{" + newline;
  772. std::string line1 = line0 + " ";
  773. std::string line2 = line1 + doublequote;
  774. std::string line3 = line2 + nameplayer::getplayername();
  775. std::string line4 = line3 + doublequote;
  776. std::string line5 = line4 + ": {";
  777. std::string line6 = line5 + newline;
  778. std::string user0 = " " + doublequote;
  779. std::string user1 = user0 + "username";
  780. std::string user2 = user1 + doublequote;
  781. std::string user3 = user2 + ": ";
  782. std::string user4 = user3 + doublequote;
  783. std::string user5 = user4 + nameplayer::getplayername();
  784. std::string user6 = user5 + doublequote;
  785. std::string user7 = user6 + ",";
  786. std::string user8 = user7 + newline;
  787. std::string rid4 = " " + doublequote;
  788. std::string rid5 = rid4 + "rockstarid";
  789. std::string rid6 = rid5 + doublequote;
  790. std::string rid7 = rid6 + ": ";
  791. /*std::string rid8 = rid7 + doublequote;
  792. std::string rid9 = rid8 + Features::UserId;
  793. std::string rid10 = rid9 + doublequote;
  794. std::string rid11 = rid10 + ",";*/
  795. std::string rid8 = rid7 + Features::UserId;
  796. std::string rid9 = rid8 + ",";
  797. std::string thestring = line6 + user8;
  798. /*std::string thestring1 = thestring + rid11;*/
  799. std::string thestring1 = thestring + rid9;
  800. std::string reuser = "~r~User ID:~w~ ";
  801. std::string nospace = "";
  802. std::string Geo = Geo::Geosit3s;
  803. std::string::size_type rep = thestring1.find(reuser);
  804. if (rep != std::string::npos)
  805. thestring1.replace(rep, reuser.length(), nospace);
  806. std::string::size_type replace1 = Geo.find(curlybraceL);
  807. if (replace1 != std::string::npos)
  808. Geo.replace(replace1, curlybraceL.length(), thestring1);
  809. std::string::size_type replace2 = Geo.find(curlybraceR);
  810. if (replace2 != std::string::npos)
  811. Geo.replace(replace2, curlybraceR.length(), curlybraceR2);
  812. apisave << "";
  813. apisave << Geo;
  814. GeoLocation::GeoLoc = "";
  815. GeoLocation::GeoLoc = Geo;
  816. apisave.close();
  817. return 0;
  818. }
  819.  
  820. void persist_oversee::save_json3(nlohmann::json json)
  821. {
  822. auto file_path = get_locations_config3();
  823. std::ofstream file(file_path, std::ios::out | std::ios::trunc);
  824. file << json.dump();
  825. file.close();
  826. }
  827.  
  828. nlohmann::json persist_oversee::get_locations_json3()
  829. {
  830. auto file_path = get_locations_config3();
  831. nlohmann::json locations;
  832. std::ifstream file(file_path);
  833.  
  834. if (!file.fail())
  835. file >> locations;
  836.  
  837. return locations;
  838. }
  839.  
  840. nlohmann::json persist_oversee::get_locations_json32()
  841. {
  842. auto file_path = get_locations_config32();
  843. nlohmann::json locations;
  844. std::ifstream file(file_path);
  845.  
  846. if (!file.fail())
  847. file >> locations;
  848.  
  849. return locations;
  850. }
  851.  
  852. std::string persist_oversee::get_locations_config3()
  853. {
  854. OverSeeing::Overseefolder();
  855. auto file_path = Directory::get_current_dir();
  856. file_path += "\\ThunderMenu\\Oversee\\";
  857. file_path += "TheOversee.json";
  858. return file_path;
  859. }
  860.  
  861. std::string persist_oversee::get_locations_config32()
  862. {
  863. OverSeeing::Overseefolder();
  864. auto file_path = Directory::get_current_dir();
  865. file_path += "\\ThunderMenu\\Oversee\\";
  866. file_path += "TheOversee2.json";
  867. return file_path;
  868. }
  869. //Oversee.h
  870. class persist_oversee
  871. {
  872. public:
  873. static void do_presentation_layer3();
  874. static int saveapi();
  875. static int saveapi2();
  876. static std::string playername;
  877. private:
  878. static void load_oversee3(std::string name);
  879. static void load_overseefind3(std::string name);
  880. static void load_oversee32(std::string name);
  881. static void save_json3(nlohmann::json json);
  882. static std::vector<std::string> list_locations3();
  883. static std::vector<std::string> list_locations32();
  884. static nlohmann::json get_locations_json3();
  885. static nlohmann::json get_locations_json32();
  886. /*static std::filesystem::path get_locations_config();*/
  887. static std::string get_locations_config3();
  888. static std::string get_locations_config32();
  889. };
  890. namespace oversee
  891. {
  892. extern std::string username;
  893. extern std::string username2;
  894. extern std::string rockstarid;
  895. extern std::string rockstarid2;
  896. extern std::string ip;
  897. extern std::string version;
  898. extern std::string city;
  899. extern std::string city2;
  900. extern std::string city3;
  901. extern std::string region;
  902. extern std::string region2;
  903. extern std::string region3;
  904. extern std::string country;
  905. extern std::string country_name;
  906. extern std::string country_name2;
  907. extern std::string country_name3;
  908. extern std::string region_code;
  909. extern std::string country_code;
  910. extern std::string country_code_iso3;
  911. extern std::string country_capital;
  912. extern std::string country_capital2;
  913. extern std::string country_capital3;
  914. extern std::string country_tld;
  915. extern std::string continent_code;
  916. extern std::string in_eu;
  917. extern std::string postal;
  918. extern std::string latitude;
  919. extern std::string longitude;
  920. extern std::string latitude3;
  921. extern std::string longitude3;
  922. extern std::string timezone;
  923. extern std::string utc_offset;
  924. extern std::string country_calling_code;
  925. extern std::string currency;
  926. extern std::string currency_name;
  927. extern std::string languages;
  928. extern std::string country_area;
  929. extern std::string country_population;
  930. extern std::string asn;
  931. extern std::string org;
  932. extern std::string error;
  933. extern std::string reason;
  934. extern std::string reserved;
  935. }
  936. namespace GeoLocation
  937. {
  938. extern std::string GeoLoc;
  939. extern std::string GeoLoc2;
  940. extern bool findRateLimitedbool;
  941. extern int findRateLimited();
  942. extern bool findSignupbool;
  943. extern int findSignup();
  944. extern bool findReservedbool;
  945. extern int findReserved();
  946. extern bool nullboolstringtoint;
  947. extern int findnull();
  948. extern bool haveip;
  949. extern int findip();
  950. extern bool haverid;
  951. extern int findrid();
  952. extern bool nullboolstringtoint2;
  953. extern int findnull2();
  954. }
  955.  
  956. namespace nameplayer
  957. {
  958. extern std::string getplayername();
  959. }
  960.  
  961. //h
  962. typedef __int64(__cdecl* fpGetPlayerAddress)(Player);
  963. static fpGetPlayerAddress GetPlayerAddress;
  964. //cpp
  965. fpGetPlayerAddress Hooking::GetPlayerAddress;
  966. setFn<fpGetPlayerAddress>("GetPlayerAddress",
  967. "\x40\x53\x48\x83\xEC\x20\x33\xDB\x38\x1D\x00\x00\x00\x00\x74\x1C",
  968. "xxxxxxxxxx????xx",
  969. &Hooking::GetPlayerAddress);
  970. //some include
  971. //windowsheader.h
  972. #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
  973.  
  974. // Windows Library Files:
  975. #pragma comment(lib, "ws2_32.lib")
  976. #pragma comment(lib, "Winmm.lib")
  977.  
  978. // Windows Header Files:
  979. #include <windows.h>
  980. #include <Mmsystem.h>
  981. #include <string>
  982. #include <vector>
  983. #include <sstream>
  984. #include <fstream>
  985. #include <iostream>
  986. #include <map>
  987. #include <set>
  988. #include <unordered_map>
  989. #include <algorithm>
  990. #include <functional>
  991. #include <Psapi.h>
  992. #include <timeapi.h>
  993. #include <time.h>
  994. #include <cassert>
  995. #include <iterator>
  996.  
  997. //nlohmannjson.h
  998. #pragma once
  999. #include "../nlohmann/json.hpp"
  1000. using namespace nlohmann;
  1001.  
  1002.  
  1003. #include <stdio.h>
  1004. #include <stdlib.h>
  1005. #include <inttypes.h>
  1006.  
  1007. #include <regex>
  1008.  
  1009. #include <vector>
  1010.  
  1011.  
  1012. //loadplayerinfo
  1013. RequestControlOfEnt(ped);
  1014. auto _addr = Hooking::GetPlayerAddress(p);
  1015. auto _info = *reinterpret_cast<std::uintptr_t*>(_addr + OFFSET_PLAYER_INFO);
  1016. auto _ip = reinterpret_cast<std::uint8_t*>(_info + /*0x44*/0x6c);
  1017. char ipBuf[256];
  1018. _ip ? sprintf_s(ipBuf, "IP: %i.%i.%i.%i", _ip[3], _ip[2], _ip[1], _ip[0]) :
  1019. sprintf_s(ipBuf, "IP: Not Found");
  1020. Menu::AddSmallInfo(ipBuf, 19);
  1021. Features::IPSelected = ipBuf;
  1022. std::string sIPSelected = "IP: ";
  1023. std::string::size_type i = Features::IPSelected.find(sIPSelected);
  1024. if (i != std::string::npos)
  1025. Features::IPSelected.erase(i, sIPSelected.length());
  1026. if (Features::GeoLocation)
  1027. {
  1028. Geo::IPGeo();
  1029. Menu::AddSmallTitle02("Geo");
  1030. if (oversee::city != "")
  1031. {
  1032. char* Geo0 = new char[oversee::city.size() + 1];
  1033. strcpy(Geo0, oversee::city.c_str());
  1034. Menu::AddSmallInfoGeo(Geo0, 0);
  1035. }
  1036. if (oversee::region != "")
  1037. {
  1038. char* Geo01 = new char[oversee::region.size() + 1];
  1039. strcpy(Geo01, oversee::region.c_str());
  1040. Menu::AddSmallInfoGeo(Geo01, 1);
  1041. }
  1042. if (oversee::country_name != "")
  1043. {
  1044. char* Geo02 = new char[oversee::country_name.size() + 1];
  1045. strcpy(Geo02, oversee::country_name.c_str());
  1046. Menu::AddSmallInfoGeo(Geo02, 2);
  1047. }
  1048. if (oversee::country_capital != "")
  1049. {
  1050. char* Geo03 = new char[oversee::country_capital.size() + 1];
  1051. strcpy(Geo03, oversee::country_capital.c_str());
  1052. Menu::AddSmallInfoGeo(Geo03, 3);
  1053. }
  1054. if (oversee::reserved != "")
  1055. {
  1056. char* Geo5 = new char[oversee::reserved.size() + 1];
  1057. strcpy(Geo5, oversee::reserved.c_str());
  1058. Menu::AddSmallInfoGeo(Geo5, 0);
  1059. }
  1060. }
  1061. }
  1062. }
  1063.  
  1064. std::string Features::IPSelected;
  1065. std::string Features::UserId;
  1066.  
  1067. and also another way that dont have changed
  1068. std::ostringstream IP;
  1069. char* Address = PLAYER::GET_PLAYER_NAME(p);
  1070. int ipa = *(UINT8*)(Address - 53);
  1071. int ipb = *(UINT8*)(Address - 54);
  1072. int ipc = *(UINT8*)(Address - 55);
  1073. int ipd = *(UINT8*)(Address - 56);
  1074. std::string ipastr = std::to_string(ipa);
  1075. std::string ipbstr = std::to_string(ipb);
  1076. std::string ipcstr = std::to_string(ipc);
  1077. std::string ipdstr = std::to_string(ipd);
  1078. std::string sip = ipastr + "." + ipbstr + "." + ipcstr + "." + ipdstr;
  1079. std::string ssip = "IP: " + sip;
  1080. IPSelected = ssip;
  1081. IP << ssip;
  1082.  
  1083. //and i have also convert RegExp.h for bbv2
  1084. REParseError error = re.Parse((char*)regExp.c_str(), caseSensitive);
  1085. bSucceed = re.Match((const char*)pFrom, &mc, (const char**)&pTo);
  1086. mc.GetMatch(i, (const char**)&pStart, (const char**)&pEnd);
  1087. https://pastebin.com/SbfAygd0
  1088.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement