Guest User

OmniBot45 Omnimaga Post Bot

a guest
Apr 4th, 2010
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.98 KB | None | 0 0
  1. alias ReDoOmnimagaRSS {
  2. set %lastrss
  3. OmnimagaRSS
  4. }
  5. alias OmnimagaRSS {
  6. rssfeed http://www.omnimaga.org/index.php?www;action=.xml;type=rss;sa=recent;limit=1
  7. if ( %lastrss != $hget(rssfeed,4).item.data ) {
  8. set %lastrss $hget(rssfeed,4).item.data
  9. set %linkpath $mid( $hget(rssfeed,4).item.data , 24 )
  10. get_title
  11. }
  12. }
  13.  
  14. alias get_title {
  15. if ( $sock(get_title) == get_title ) {
  16. sockclose get_title
  17. }
  18. /write -c log New Request
  19. sockopen get_title www.omnimaga.org 80
  20. set %page
  21. }
  22.  
  23. on *:sockopen:get_title:{
  24. if ($sockerr > 0) {
  25. echo -a Error: $sock(get_title).wsmsg
  26. }
  27. else {
  28. sockwrite -tn $sockname GET %linkpath HTTP/1.1
  29. sockwrite -n $sockname Accept: */*
  30. sockwrite -tn $sockname User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12 $+ $crlf
  31. sockwrite -n $sockname Host: www.omnimaga.org
  32. sockwrite -n $sockname Connection: close
  33. sockwrite -n $sockname $crlf $+ $crlf
  34. }
  35. }
  36.  
  37. on *:sockread:get_title:{
  38. if ($sockerr > 0) return
  39. sockread &get_titling
  40. if ($sockbr == 0) return -
  41. else {
  42. write log $bvar( &get_titling , 1 , 9999999999999).text
  43. if ( $bfind(&get_titling,1, $mid( $hget(rssfeed,4).item.data , $pos( $hget(rssfeed,4).item.data , $chr(35) , 1 ) ) ) ) {
  44. bread log 1 9999999 &log
  45. set %start_pos $bfind(&log,1, $chr(60) $+ title $+ $chr(62) )
  46. set %end_pos $bfind(&log, %start_pos , $chr(60) $+ $chr(47) $+ title $+ $chr(62) )
  47. set %now_this_is_title $mid( $bvar( &log , %start_pos , $calc( %end_pos - %start_pos )).text , 8)
  48. set %start_pos $bfind(&log, $calc( $bfind(&log,1, $right( $hget(rssfeed,4).item.data , -53 ) ) - 3000 ) , View the profile of )
  49. set %end_pos $bfind(&log, %start_pos , $chr(34) )
  50. set %now_this_is_author $mid( $bvar( &log , %start_pos , $calc( %end_pos - %start_pos )).text , 21)
  51. msg #omnimaga 1New Post by 10 $+ %now_this_is_author $+ 1 in4 $iif( $len( %now_this_is_title ) > 31 , $iif( $right( $mid( %now_this_is_title , 1 , 27 ) , 1 ) != $chr(32) ,$mid( %now_this_is_title , 1 , 27 ) $+ ..., $mid( %now_this_is_title , 1 , 26 ) $+ ... ) , %now_this_is_title ) $+ 12 $mid( $hget(rssfeed,4).item.data , 1 , $calc( $pos( $hget(rssfeed,4).item.data , $chr(35) , 1) - 1 ) )
  52. echo 1New post by ( $+ 10 $+ %now_this_is_author $+ 1 $+ ) 1in4 $iif( $len( %now_this_is_title ) > 31 , $iif( $right( $mid( %now_this_is_title , 1 , 27 ) , 1 ) != $chr(32) ,$mid( %now_this_is_title , 1 , 27 ) $+ ..., $mid( %now_this_is_title , 1 , 26 ) $+ ... ) , %now_this_is_title ) $+ 12 $mid( $hget(rssfeed,4).item.data , 1 , $calc( $pos( $hget(rssfeed,4).item.data , $chr(35) , 1) - 1 ) )
  53. sockclose get_title
  54. }
  55.  
  56. }
  57. }
  58.  
  59. alias -l grabdata { if ($regex($1-,(<([^>]+)>)(.+)</\2>)) return $regml(1) $+ $chr(255) $+ $regml(3) }
  60.  
  61. alias rssfeed {
  62. if ($1 == $null) return
  63. else {
  64. if ($left($1,7) != http://) echo $color(text) -a Incorrect URL format, please include http:// at the beginning.
  65. else {
  66. if ($sock(rssfeed)) sockclose rssfeed
  67. ; grab the host from $1 and connect to it
  68. sockopen rssfeed $gettok($1,2,47) 80
  69. ; store $1 in a sockmark of the rssfeed socket
  70. sockmark rssfeed $1
  71. }
  72. }
  73. }
  74.  
  75. on *:sockopen:rssfeed:{
  76. if ($sockerr > 0) {
  77. return
  78. }
  79. ; if the hash table rssfeed exists from a previous execution, clear it
  80. if ($hget(rssfeed)) hfree rssfeed
  81. ; GET the page using the path after the host in the sockmark
  82. sockwrite -n $sockname GET / $+ $gettok($sock($sockname).mark,3-,47) HTTP/1.1
  83. ; specify the host as well from the sockmark
  84. sockwrite -n $sockname Host: $gettok($sock($sockname).mark,2,47)
  85. sockwrite -n $sockname Connection: keep-alive
  86. sockwrite -n $sockname
  87. }
  88.  
  89. on *:sockread:rssfeed:{
  90. if ($sockerr > 0) return
  91. :nextread
  92. sockread %temp
  93. if (%temp == $null) var %temp = -
  94. if ($sockbr == 0) {
  95. return
  96. }
  97. if ((</rdf:RDF> isin %temp) || (</rss> isin %temp)) {
  98. ; if the end of an RSS file is found, end it
  99. sockclose $sockname
  100. if (%temp) unset %temp
  101. return
  102. }
  103. if ($grabdata(%temp)) {
  104. ; if it matches an RSS item type (see the grabdata alias above) store the tag in %item
  105. var %item = $gettok($grabdata(%temp),1,255)
  106. ; if there is no item in the hash table that matches that tag, make it the first
  107. ; -> e.g. <title>1
  108. if (!$hfind(rssfeed,%item $+ *,0,w)) hadd -m rssfeed %item $+ 1 $gettok($grabdata(%temp),2,255)
  109. ; if not, loop through it items in the hash table and find the highest matching tag
  110. ; then save it as an item with a number of one higher than the highest
  111. ; -> e.g. there's a <title>1 so store it as <title>2
  112. ; and break out of the loop by setting the looping var higher than the while condition
  113. else {
  114. var %x = 1
  115. while (%x <= $hget(rssfeed,0).item) {
  116. if ($hfind(rssfeed,%item $+ *,0,w)) {
  117. var %item = %item $+ $calc($ifmatch + 1)
  118. hadd -m rssfeed %item $gettok($grabdata(%temp),2,255)
  119. var %x = $hget(rssfeed,0).item
  120. }
  121. inc %x
  122. }
  123. }
  124. }
  125. goto nextread
  126. }
  127.  
  128. on *:sockclose:rssfeed:{
  129. ; if the socket is closed by the remote host say so
  130. }
  131.  
  132. menu status,channel,query {
  133. Hash Table Editor:hedit
  134. }
  135. alias hedit { dialog -m hedit hedit }
  136. dialog hedit {
  137. title Hash Table Editor
  138. size -1 -1 260 142
  139. option dbu
  140.  
  141. edit "Coded By: Imrac", 1, 0 131 260 11, read right autohs
  142.  
  143. box "Tables", 2, 2 3 75 125
  144. list 3, 7 13 65 94, vsbar sort
  145. button "Add", 4, 7 101 32 11
  146. button "Remove", 5, 40 101 32 11
  147. button "Rename", 6, 7 113 32 11
  148. button "Clear", 7, 40 113 32 11
  149.  
  150. box "Items", 8, 80 3 178 125
  151. list 9, 85 13 65 102, vsbar sort
  152.  
  153. button "Add", 10, 85 113 32 11
  154. button "Remove", 11, 118 113 32 11
  155.  
  156. box "Data", 12, 155 9 98 63
  157. text "Item", 13, 158 17 50 9
  158. edit "",14, 158 25 92 11, autohs
  159. text "Data", 15, 158 37 50 9
  160. edit "", 16, 158 45 92 11, autohs
  161. button "Update", 17, 189 58 30 11
  162.  
  163. box "Search", 18, 155 74 98 51
  164. check "Data", 19, 179 83 24 9
  165. check "Table", 20, 207 83 24 9
  166. edit "", 21, 158 95 92 11, autohs
  167. check "Regular Ex.", 22, 158 111 35 9
  168. button "Clear", 23, 215 109 35 11
  169. }
  170.  
  171. on *:Dialog:hedit:*:*:{
  172. if ($devent == init) {
  173. var %x = $hget(0)
  174. did -o $dname 2 1 Tables $+($chr(40),%x,$chr(41))
  175. did -b $dname 5-23
  176. while (%x) {
  177. did -a $dname 3 $hget(%x)
  178. dec %x
  179. }
  180. did -f $dname 3
  181. }
  182. if ($devent == sclick) {
  183. var %tb = $did($dname,3).seltext
  184. var %it = $did($dname,9).seltext
  185.  
  186. If ($did == 1) { did -j $dname 3 }
  187.  
  188. ; // Click On Table List //
  189. If ($did == 3) && (%tb) {
  190. did -e $dname 5-10
  191. did -u $dname 9
  192. iu
  193. If ($did($dname,21).text) { itemsearch }
  194. did -o $dname 1 1 Table: ' $+ %tb $+ ' Items: $hget(%tb,0).item Size: $hget(%tb).size
  195. }
  196.  
  197. ; // Click On Item List //
  198. If ($did == 9) && ($did($dname,$did).seltext) {
  199. did -e $dname 11-17
  200. var %t = $did($dname,3).seltext
  201. var %i = $did($dname,9).seltext
  202. did -o $dname 14 1 %i
  203. did -o $dname 16 1 $hget(%t,%i)
  204. }
  205.  
  206. ; // ADD NEW HASH TABLE BUTTON //
  207. If ($did == 4) {
  208. var %n = $input(Hash Table Name:,equd,New Hash Table)
  209. If (%n == $null) { derror -c No Name Given }
  210. ElseIf ($regex(%n,/ /)) { derror -c Hash Table Name Can Not Contain Spaces }
  211. ElseIf ($hget(%n)) { derror -c Hash Table Name Already Exists }
  212. Else {
  213. var %s = $input(Hash Table Size:,equd,New Hash Table,100)
  214. If (%s == $null) { derror -c No Size Specified }
  215. ElseIf (%s !isnum 1-) || (%s != $int(%s)) { derror -c Invalid Size Specified }
  216. Else {
  217. hmake %n %s
  218. did -o $dname 1 1 Success: Made Hash Table.
  219. did -a $dname 3 %n
  220. did -o $dname 2 1 Tables $+($chr(40),$hget(0),$chr(41))
  221. }
  222. }
  223. }
  224.  
  225. ; // Remove Hash table //
  226. If ($did == 5) {
  227. If ($input(Are You Sure You Want To Remove Hash Table ' $+ %tb $+ ', wudy, Remove Table)) {
  228. hfree %tb
  229. did -o $dname 1 1 Success: Removed Hash Table.
  230. did -d $dname 3 $did($dname,3).sel
  231. did -r $dname 14,16,9,21
  232. did -b $dname 5-23
  233. did -o $dname 2 1 Tables $+($chr(40),$hget(0),$chr(41))
  234. did -o $dname 8 1 Items
  235. }
  236. }
  237.  
  238. ; // Rename Hash Table
  239. If ($did == 6) {
  240. var %n = $input(Hash Table's New Name:,equd,Rename Hash Table)
  241. If (%n == $null) { derror -r No New Name Specified }
  242. ElseIf ($regex(%n,/ /)) { derror -r Hash Table Name Can Not Contain Spaces }
  243. Else {
  244. did -o $dname 1 1 Success: Renamed Hash Table.
  245. hrename %tb %n
  246. did -d $dname 3 $did($dname,3).sel
  247. did -ac $dname 3 %n
  248. }
  249. }
  250.  
  251. ; // Clear Hash Table //
  252. If ($did == 7) {
  253. var %c = $input(Are You Sure You Want To Clear All Items From ' $+ %tb $+ '?, wudy, Clear Table)
  254. If (%c) { hdel -w %tb * | iu | did -o $dname 1 1 Success: Removed Hash Table. }
  255. }
  256.  
  257. ; // Add item to table //
  258. If ($did = 10) {
  259. var %ni = $input(New Item Name:,equd,Add Item)
  260. If (%ni == $null) { derror -a No Item Name Specified }
  261. ElseIf ($regex(%ni,/ /)) { derror -a Item Name Can Not Contain Spaces }
  262. ElseIf ($hget(%tb,%ni)) { derror -a Item Already Exists }
  263. Else {
  264. var %nd = $input(New Item Data:,equdv,Add Item)
  265. If (%nd == $cancel) { derror -a Cancelled }
  266. Else {
  267. hadd %tb %ni %nd
  268. did -o $dname 1 1 Success: Added Item.
  269. itemsearch
  270. }
  271. }
  272. }
  273.  
  274. ; // Remove an item from the table //
  275. If ($did = 11) {
  276. var %yn = $input(Are You Sure You Want To Delete ' $+ %it $+ '.,wdyu,Remove Item)
  277. if (%yn) {
  278. hdel %tb %it
  279. itemsearch
  280. did -o $dname 1 1 Success: Removed Item.
  281. }
  282. }
  283.  
  284. ; // Update an item //
  285. If ($did == 17) {
  286. var %ni = $did($dname,14).text
  287. If (%ni == $null) { derror -u No Item Name Given }
  288. ElseIf ($regex(%ni,/ /)) { derror -u Item Name Can Not Contain Spaces }
  289. Else {
  290. did -o $dname 1 1 Success: Updated Item.
  291. hdel %tb %it
  292. hadd %tb %ni $did($dname,16).text
  293. did -d $dname 9 $did($dname,9).sel
  294. did -ac $dname 9 %ni
  295. If ($did($dname,21).text) { itemsearch }
  296. }
  297. }
  298. If ($did == 19) { if ($did($dname,21).text) { itemsearch } }
  299. If ($did == 20) { if ($did($dname,21).text) { itemsearch } }
  300. If ($did == 22) { if ($did($dname,21).text) { itemsearch } }
  301. If ($did == 23) { did -r $dname 21 | did -u $dname 19,20,22 | itemsearch }
  302. }
  303.  
  304. If ($devent == edit) {
  305. If ($did = 21) { itemsearch | did -f $dname 21 }
  306. }
  307. }
  308.  
  309.  
  310. alias -l itemsearch {
  311. If ($did($dname,21).text) {
  312. var %t = $did($dname,3).seltext
  313. var %sel = $did($dname,9).seltext
  314. var %f = $iif($did($dname,22).state,r,w)
  315. var %f = $iif($did($dname,20).state,$upper(%f),$lower(%f))
  316. var %d = $iif($did($dname,19).state,.$true,)
  317. var %s = $did($dname,21).text
  318. var %x = $iif(%d,$hfind(%t,%s,0,%f).data,$hfind(%t,%s,0,%f))
  319. did -o $dname 8 1 Items $+($chr(40),%x,/,$hget(%t,0).item,$chr(41))
  320. did -r $dname 9
  321. while (%x) {
  322. if (%d) var %st = $hfind(%t,%s,%x,%f).data
  323. else var %st = $hfind(%t,%s,%x,%f)
  324. did -a $dname 9 %st
  325. dec %x
  326. }
  327. If (%sel) && ($didreg($dname,9,/^ $+ %sel $+ $/)) { did -c $dname 9 $v1 }
  328. Else {
  329. did -r $dname 14,16
  330. did -b $dname 11-17
  331. }
  332. }
  333. Else {
  334. iu
  335. }
  336. }
  337.  
  338. alias -l iu {
  339. var %tb = $did($dname,3).seltext
  340. var %it = $did($dname,9).seltext
  341. var %x = $hget(%tb,0).item
  342. did -r $dname 9
  343. did -o $dname 8 1 Items $+($chr(40),%x,$chr(41))
  344. did -e $dname 18-23
  345. while (%x) { did -a $dname 9 $hget(%tb,%x).item | dec %x }
  346. If (%it) && ($didreg($dname,9,/^ $+ %it $+ $/)) { did -c $dname 9 $v1 }
  347. Else {
  348. did -r $dname 14,16
  349. did -b $dname 11-17
  350. }
  351. }
  352.  
  353.  
  354.  
  355. alias hrename {
  356. var %t1 = $1, %t2 = $2
  357. hmake %t2 $hget(%t1).size
  358. var %x = $hget(%t1,0).item
  359. while (%x) {
  360. hadd %t2 $hget(%t1,%x).item $hget(%t1,%x).data
  361. dec %x
  362. }
  363. hfree %t1
  364. }
  365.  
  366. alias -l derror {
  367. If ($1 == -c) { did -o $dname 1 1 Error: Unable To Create Hash Table. ( $+ $2- $+ ) }
  368. ElseIf ($1 == -r) { did -o $dname 1 1 Error: Unable To Rename Hash Table. ( $+ $2- $+ ) }
  369. ElseIf ($1 == -a) { did -o $dname 1 1 Error: Unable To Add Item. ( $+ $2- $+ ) }
  370. ElseIf ($1 == -u) { did -o $dname 1 1 Error: Unable To Update Item. ( $+ $2- $+ ) }
  371. }
  372. alias tinyurl {
  373. var %c $iif($isid,return,echo -a)
  374. if ($1) && (!$com(u)) && (!$sock(tinyurl)) {
  375. if ($regex($1,/^(?:(?:f|ht)tps?:\/\/|[^<>\/:\s])+[^<>.:\/\s]+(?:\.[^\/:<>.\s]{2,6})+(?:\/.*?)?$/i)) {
  376. sockopen tinyurl www.tinyurl.com 80
  377. sockmark tinyurl /create.php?url= $+ $remove($1-,$chr(32))
  378. .comopen u Wscript.Shell
  379. .comclose u $com(u,run,1,bstr*,$(%comspec%,) /c ping.exe -n 2 127.0.0.1 >nul,uint,0,bool,true)
  380. %c $iif(%tinyurl,$v1,No result.)
  381. }
  382. else %c Invalid URL!
  383. }
  384. else %c $iif($1,Please be patient...,Input a URL!)
  385. }
  386. on *:sockopen:tinyurl: {
  387. if ($sockerr) {
  388. set -u3 %tinyurl Error connecting: $sock($sockname).wsmsg
  389. sockclose $sockname
  390. }
  391. else {
  392. sockwrite -n $sockname GET $sock($sockname).mark HTTP/1.1
  393. sockwrite -n $sockname Host: tinyurl.com
  394. sockwrite -n $sockname User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8)
  395. sockwrite -n $sockname $crlf
  396. }
  397. }
  398. on *:sockread:tinyurl: {
  399. if ($sockerr) {
  400. set -u3 %tinyurl Error connecting: $sock($sockname).wsmsg
  401. sockclose $sockname
  402. }
  403. else {
  404. var %x
  405. sockread %x
  406. if ($regex(%x,/<blockquote><b>(.*?)<\/b><br>/)) {
  407. set -u3 %tinyurl $regml(1)
  408. sockclose $sockname
  409. }
  410. }
  411. }
  412. on $*:TEXT:/^[.!@]tiny(url)? .*?$/Si:#: {
  413. if (!%tinyurl. [ $+ [ $2 ] ]) {
  414. var %c = $tinyurl($2)
  415. msg $chan $iif(error !isin %c && invalid !isin %c,TinyURL converted: %c $+([,From $len($2) to $len(%c) chars,]),%c)
  416. set -u5 %tinyurl. $+ $2 1
  417. }
  418. }
Add Comment
Please, Sign In to add comment