Advertisement
kolpastebin

DatabaseLeaks.ash

Jul 6th, 2014
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. void listAppend(string [int] list, string entry)
  2. {
  3. int position = list.count();
  4. while (list contains position)
  5. position += 1;
  6. list[position] = entry;
  7. }
  8.  
  9. boolean stringHasSuffix(string s, string suffix)
  10. {
  11. if (s.length() < suffix.length())
  12. return false;
  13. else if (s.length() == suffix.length())
  14. return (s == suffix);
  15. else if (substring(s, s.length() - suffix.length()) == suffix)
  16. return true;
  17. return false;
  18. }
  19.  
  20. void parseNames(string s, string [int] names)
  21. {
  22. string [int][int] matches = s.group_string("<span class=\"i\">([^<]*)</span>");
  23.  
  24. //print("matches = " + matches.to_json());
  25.  
  26. foreach key in matches
  27. {
  28. string name = matches[key][1];
  29.  
  30. if (name.length() >= 2 && name.stringHasSuffix(", "))
  31. name = name.substring(0, name.length() - 2);
  32. //print("name = \"" + name + "\"");
  33.  
  34. names.listAppend(name);
  35. }
  36.  
  37. }
  38.  
  39. void main()
  40. {
  41. string page_text = visit_url("type69.php?date=2020-01-01", false);
  42.  
  43. string [int] split = page_text.split_string("<p>");
  44. string [int] testing_item_names;
  45. string [int] testing_skill_names;
  46. string [int] testing_familiar_names;
  47.  
  48. if (split.count() < 7)
  49. {
  50. print("split too low: " + split.count());
  51. return;
  52. }
  53.  
  54. parseNames(split[2], testing_item_names);
  55. parseNames(split[4], testing_skill_names);
  56. parseNames(split[6], testing_familiar_names);
  57.  
  58. print(testing_item_names.count() + " items seen.");
  59. print(testing_skill_names.count() + " skills seen.");
  60. print(testing_familiar_names.count() + " familiars seen.");
  61. foreach key in testing_item_names
  62. {
  63. string item_name = testing_item_names[key];
  64. item it = item_name.to_item();
  65. if (it != $item[none])
  66. continue;
  67. print("Unknown item name \"" + item_name + "\"");
  68. }
  69. foreach key in testing_skill_names
  70. {
  71. string name = testing_skill_names[key];
  72. skill s = name.to_skill();
  73. if (s != $skill[none])
  74. continue;
  75. print("Unknown skill name \"" + name + "\"");
  76. }
  77. foreach key in testing_familiar_names
  78. {
  79. string name = testing_familiar_names[key];
  80. familiar f = name.to_familiar();
  81. if (f != $familiar[none])
  82. continue;
  83. print("Unknown familiar name \"" + name + "\"");
  84. }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement