This script can be VERY useful for scripters who are trying to help someone out, and distributing a script easily.
(Supported abilities in current version):
This is my first socket script, constructive criticism is very welcome :D (Just don't say anything unless you know a fix for it, kthx.)
(Thanks to mountaindue for pointing out a better way to use /did)
(Thanks to jonesy44 for pointing out a better way to draw the combobox items)
-What to look forward to-
-Screenshots-
/*;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-Script by H_M (With some help from friends)
-Version 1.3.2 (No bugs found, stable)
-Contact info: diotecktec@gmail.com
-IRC network: irc.wyldryde.org #hackerz
*/;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
alias paste {
if ($dialog(paste) == $null) {
dialog -m paste paste
write_combobox
did -b paste 7,22 1
did -ck paste 14 1
}
else {
dialog -v paste paste
}
}
alias write_combobox { ; Thanks jonesy44
var %string = Text C C++ HTML Java Javascript Lua Perl PHP Python Ruby ABAP ActionScript Ada Apache-Log-File AppleScript ASM ASP AutoIt Bash Blitz-Basic BNF C C-for-Macs CAD-DCL CAD-Lisp Coldfusion CSS D Delphi Diff DOS Eiffel Fortran FreeBasic Genero GameMaker Groovy Haskell mIRC
var %x = 1
while (%x <= $numtok(%string,32)) {
did -o paste 14 %x $gettok(%string,%x,32)
inc %x
}
}
menu channel {
Pastebin:/paste
}
alias box_size {
var %opt = $1
if (%opt == 2) { var %target = pastehist | var %cid = 5 }
else { var %target = paste | var %cid = 6 }
var %x = 1
var %n = $did(%target,%cid).lines
var %size = 0
while %x <= %n {
var %line = $did(%target,%cid,%x).text
if (%opt == 1) {
if (%line == $null) { %size = $calc(%size + $len(% $+ 0A)) }
else { %size = $calc(%size + $len($urlencode(%line) $+ % $+ 0A)) }
}
else { %size = $calc(%size + $len(%line)) }
inc %x
}
return %size
}
alias urlencode {
var %r = $regsubex($$1-,/([!#$%&'()*+,/:;=?@rn[] ])/g,% $+ $($base($asc(t),10,16)))
$iif($isid,return,echo -a) %r
}
alias hist_load {
var %x = $lines(pastebinhist.txt)
if ($dialog(pastehist) !== $null) {
dialog -t pastehist Pastebin History (Total Post: %x $+ )
}
var %l = 1
while %x >= 1 {
if ($dialog(pastehist) !== $null) {
did -o pastehist 1 %l $read(pastebinhist.txt,nt,%x)
}
dec %x
inc %l
}
}
dialog pastehist {
title Pastebin History (Total Post: 0)
option dbu
size -1 -1 350 200
list 1, 5 5 140 180, vsbar
text "0 chars, 0 lines, 0 kb, posted: N/A", 2, 150 190 195 8, center
button "Close", 3, 75 185 70 12
button "Clear History", 4, 5 185 70 12
edit "", 5, 150 5 195 183, multi vsbar hsbar read
}
dialog paste {
title "Pastebin Uploader v1.3.2 (Script by H_M)"
option dbu
size -1 -1 360 325
edit "", 4, 28 11 60 10
edit "", 19, 223 11 50 10 ; 300 11 50 10 - 235 295 50 10
edit "", 6, 10 24 340 263, multi return hsbar vsbar autohs autovs
box "Input", 5, 5 4 350 288
box "", 9, 5 289 350 31
button "Paste", 7, 325 294 25 12
button "Clear", 8, 325 306 25 12
button "Settings", 22, 289 294 35 12
button "History", 23, 289 306 35 12
combo 14, 300 11 50 10, drop
link "", 11, 71 311 130 8
text "Chars Used: 0 (1 line)", 10, 9 293 100 8
text "URL (Right click to copy):", 12, 9 311 60 8
text "Name:", 21, 11 13 17 8
text "Status: Waiting", 13, 9 302 50 8
text "Highlight:", 17, 276 13 24 8
text "Priv. Paste (Empty for normal):", 18, 147 13 76 8
}
on *:dialog:pastehist:*:*: {
if ($devent == sclick) {
if ($did == 3) { dialog -x pastehist }
if ($did == 4) {
write -c pastebinhist.txt
did -r pastehist 1,5 1
did -o pastehist 2 1 0 chars, 0 lines, 0 kb, posted: N/A
dialog -t pastehist Pastebin History (Total Post: 0)
}
if ($did == 1) {
did -r pastehist 5
var %fname = $remove($did(pastehist,1).seltext,.,:,/) $+ .txt
loadbuf 0 -o pastehist 5 %fname
did -o pastehist 2 1 $box_size(2) chars, $calc($did(5).lines - 1) lines, $round($calc($file(%fname).size / 1000),2) kb, posted: $asctime($file(%fname).ctime,m/dd/yy - h:nntt)
}
}
if ($devent == dclick) {
if ($did == 1) {
run $did(pastehist,1).seltext
dialog -x pastehist
}
}
}
on *:dialog:paste:*:*: {
if ($devent == close) {
if ($dialog(pastehist) !== $null) { dialog -x pastehist }
}
if ($devent == edit) {
if ($did == 6) {
if ($box_size == 0) { did -b paste 7 1 }
else { did -e paste 7 1 }
did -o paste 10 1 Chars Used: $box_size ( $+ $did(paste,6).lines $iif($did(paste,6).lines == 1,line,lines)) $+ )
}
if ($did == 19) {
if ($did(paste,19).text !== $null) { set %privatepst $remove($lower($did(paste,19).text),!,#,$,%,&,',*,+,/,:,;,,=,?,@) $+ . }
else { unset %privatepst }
}
}
if ($devent == sclick) {
if ($did == 23) {
if ($dialog(pastehist) == $null) {
if ($dialog(pasteset) !== $null) { dialog -x pasteset }
dialog -mo pastehist pastehist
hist_load
}
else { dialog -ve pastehist pastehist }
}
if ($did == 14) {
if ($did(paste,14).seltext !== none) || ($did($paste,14).seltext == $null) { set %pst.frmt $replace($did(paste,14).seltext,-,$chr(32)) }
else { unset %pst.frmt }
}
if ($did == 7) {
if ($did(6) !== $null) {
%paste.user = $iif($did(4) == $null,Anonymous,$did(4))
sockclose paste
did -o paste 13 1 Status: Uploading...
did -b paste 4,6,7,14,19 1
sockopen Paste %privatepst $+ pastebin.com 80
}
}
if ($did == 8) {
did -b paste 7 1
did -o paste 10 1 Chars Used: 0 (1 line)
did -o paste 13 1 Status: Waiting
did -re paste 4,6,11,19 1
did -ec paste 14 1
unset %privatepst
unset %pst.frmt
}
}
if ($devent == dclick) { if ($did == 11) { run $did(paste,11).text } }
if ($devent == rclick) { if ($did == 11) { clipboard $did(paste,11).text } }
}
on *:sockopen:Paste: {
var %a = $+(parent_id=&format= $+ $iif(%pst.frmt,$lower(%pst.frmt),text) $+ &paste=Send&poster=,%Paste.User,&code2=,)
unset %pst.frmt
%paste_lc = 0
%paste_found302 = 0
sockwrite -n $sockname POST /pastebin.php HTTP/1.0
sockwrite -n $sockname Host: %privatepst $+ pastebin.com
sockwrite -n $sockname Content-Type: application/x-www-form-urlencoded
sockwrite -n $sockname Content-length: $calc($len(%a) + $box_size(1))
sockwrite $sockname $crlf
sockwrite $sockname %a
unset %privatepst
var %cnt = 1
var %ttl = $did(paste,6).lines
while %cnt <= %ttl {
var %line = $did(paste,6,%cnt).text
if (%line == $null) {
%line = % $+ 0A
sockwrite $sockname %line
}
else {
var %encd = $urlencode(%line)
sockwrite $sockname %encd $+ % $+ 0A
}
inc %cnt
}
}
on *:sockread:Paste: {
var %a
sockread %a
if (%paste_lc == 0 && 200 isin %a) {
did -o paste 13 1 Status: Pasting failed
sockclose $sockname
unset %paste_lc
unset %paste_found302
halt
}
if (%paste_lc == 0 && 302 isin %a) {
did -o paste 13 1 Status: Completed
%paste_found302 = 1
inc %paste_lc
}
else if (%paste_found302 == 1 && Location: isin %a) {
var %t = $regex(%a,/Location: (.*)$/g)
did -o paste 11 1 $regml(1)
write pastebinhist.txt $regml(1)
savebuf -eo paste 6 $remove($regml(1),.,:,/) $+ .txt
hist_load
unset %paste_lc
unset %paste_found302
halt
}
}
hey dude great script, trying to figure how you make it send information to the pastebin box, can you send me a pm with a quick explanation, trying to learn how to send information, and also how to make it send the info when you put it in the box aka
:you put your text in to the pastebin box, then you send:
HOW???
also pastebin has a new layout, so this script may no longer work right :/
Hmm, it doesn't get the full script sometimes.
I tested it with this slapper script: http://obi.pastebin.com/m3e956cd3
But this is all it gets when I upload it with the script: http://pastebin.com/d293af14c
It happened with a few other scripts, but then I tried copying a bunch of chat from the buffer and it pasted fine with the script. I glanced at the code, I think it's in the way the "alias urlencode" sets the %r, but I figured let you know since it's a great script, I really like it and I know a lot of ppl seem to like it too. :P
Also just a thought, have the pastebinhist.txt and httppastebincom***.txt be wrote to $scriptdir since a lot of ppl have scripts in a Scripts or System folder inside the mirc directory. And maybe even have it write to it own folder in there, something like this maybe...
on *:LOAD:{
if (!$exists($scriptdirPastbin)) {
mkdir $scriptdirPastbin
}
}
;Then for the pastebinhist.txt and httppastebincom***.txt
write $scriptdirPastbin\pastebinhist.txt
It's not gonna be like that in your script obviously but just a quick way to show u what I was thinking. Once again, great script. :)
Furby, what did I do to you lmao? I only said that comment as a joke. Also, TropicalMeltdown copies code, which is lame. I write most my stuff originally -- Or I find code and change it a LOT (I don\'t call it my own if it\'s still even remotely the same).
This time since it was my first socket script, I looked at another script real quick to see how it worked, that\'s all. (It was yours, http://www.hawkee.com/snippet/3909/, but it didn\'t work, so I tried to work on it and fixed it up -- If it\'ll make you feel better, i\'ll add a credit in that says you wrote the original script, sorry if I upset you mate -- But in my defence, the only thing that is alike in my code is pretty much the dialog name and socket name, and that\'s it.)
--
And jonesy44: mIRC highlighting has an internal error, and it\'s not my scripts fault. Try using it directly on the website, it will do the same thing mate :D
H_M, I have to ask, are you TropicalMeltdown by any chance?
a - your both assholes
b - you take everything everyone says the wrong way
c - you both post a message after another message after another message.........
it all bases around this one: http://www.hawkee.com/snippet/4758/
H_M, you can edit any of your own comments to add to it or just change it, this makes it so u dont have to make 3 posts in two minutes.
Very nice script btw. Really handy for people who pastebin even just every so often.
Jonesy44, wth are you talking about? Please explain your statement because I find it highly unlikely that a simple socket managed to accidntly open up some vulnerability in a website.
Jonesy, umm.. What?! No, all it does is fill in the textboxes \"poster\" and \"code2\" then reads the return of the location.
There\'s no way it would \"hack the site\", it\'s just a glitch.
I posted the script itself.... http://pastebin.com/d3a067020 .... Did nothing.
RE: \"; If anyone has any idea on how to get the list better, let me know\";
var %string = PHP SQL .. all the names in one variable
;sets all the paramaters into one string, rather than redoing it over and over again. and sets a constant value of paramaters used later
var %x = 1
;provides a variable number for select the token from %string
while (%x <= $numtok(%string,32)) {
did -o paste 14 %x $gettok(%string,%x,32)
;adds the token from the string to the list in slot %x
inc %x
}