mIRC PasteBin
Posted by HellRaz0r
Wednesday, June 10, 2009
Description: lets you use pastebin.com from within mIRC. Best PasteBin script ever!
#-- PasteBin Uploader - by HellRaz0r
# /Paste - Open the paste dialog.
# /PasteBin_Global_On - Enable F12 Global.
# /PasteBin_Global_Off - Disable F12 Global.
#--
# <F12> Open the paste dialog. PasteBin_Global_On Must be set.
#--
# keyhook.dll - Create hook to see when F12 is pressed outside of mIRC. (Not Included)
# keyhook origin: http://www.jinxdesign.net/keyhook/
#--
# Tips for loading:
# Recommended: Create new script file: /run notepad.exe PasteBin.mrc > Paste > /load -rs PasteBin.mrc
# [OR] Add to the end of your Remote. (ALT+R)
alias Paste {
if ($dialog(PasteBin)) { dialog -c PasteBin }
dialog -dmie PasteBin PasteBin
did -a PasteBin 5 None
did -a PasteBin 5 Bash
did -a PasteBin 5 C
did -a PasteBin 5 C++
did -a PasteBin 5 HTML
did -a PasteBin 5 Java
did -a PasteBin 5 Javascript
did -a PasteBin 5 Lua
did -a PasteBin 5 Perl
did -a PasteBin 5 PHP
did -a PasteBin 5 Python
did -a PasteBin 5 Ruby
did -c PasteBin 5 1
}
dialog PasteBin {
title "PasteBin"
size -1 -1 343 335
option dbu
box "Code", 1, 6 6 328 260
edit "", 2, 11 17 318 243, multi return autovs vsbar
box "Options", 3, 6 272 160 40
text "Syntax Highlighting:", 4, 11 284 50 7
combo 5, 65 284 50 19, drop
text "Your Name:", 6, 11 298 30 7
edit "Anonymous", 7, 65 297 50 11
button "Upload", 8, 123 289 37 12
box "Output", 9, 174 272 160 40
edit "", 10, 181 284 148 10, read disable
button "Copy to Clipboard", 11, 181 297 51 10, disable
button "Send to Channel", 12, 237 297 51 10, disable
button "Browser", 13, 292 297 37 10, disable
button "Reset", 14, 250 316 37 12, hide
button "Close", 15, 297 316 37 12
link "", 16, 6 316 145 8, hide
}
on *:dialog:PasteBin:sclick:8:{
if (!$len($did(PasteBin,2,1))) { did -ra PasteBin 10 Code box is empty. | halt }
did -b PasteBin 2,5,7,8
did -v PasteBin 14
did -ra PasteBin 10 Uploading! Please wait.
sockopen PasteBin_ $+ $ticks pastebin.com 80
}
on *:dialog:PasteBin:sclick:11:{
if (http://* iswm $did(PasteBin,16)) { clipboard $did(PasteBin,16) }
}
on *:dialog:PasteBin:sclick:12:{
if (http://* iswm $did(PasteBin,16)) && (#* iswm $active) { msg $active $did(PasteBin,16) }
else { .echo -q $input(No channel is active..,o,Error) }
}
on *:dialog:PasteBin:sclick:13:{ if (http://* iswm $did(PasteBin,16)) run $v2 }
on *:dialog:PasteBin:sclick:14:{
did -r Pastebin 10
did -h PasteBin 14
did -b PasteBin 10,11,12,13
did -e PasteBin 2,5,6,7,8
sockclose PasteBin_*
}
on *:dialog:PasteBin:sclick:15:{ dialog -x PasteBin }
on *:sockopen:PasteBin_*:{
if ($sockerr) { echo 4 -s PasteBin Error: $sock($sockname).wsmsg | halt }
var %sw = sockwrite -n $sockname, %x = 1
while (%x <= $did(PasteBin,2).lines) {
var %encode = $urlencode($did(PasteBin,2,%x))
if (%encode) { bset &lines $calc($bvar(&lines,0) + 1) $regsubex(%encode,/(.)/g,$asc(\t) $+ $chr(32))) 13 10 }
inc %x
}
bset -t &form 1 parent_pid=&format= $+ $replace($did(PasteBin,5).seltext,None,text,c++,cpp,HTML,html4strict) $+ &code2=
bcopy &form $calc($bvar(&form,0) + 1) &lines 1 -1
bset -t &form $bvar(&form,0) &poster= $+ $iif($did(PasteBin,7),$v1,Anonymous) $+ &paste=Send&expiry=m&email=
%sw POST / HTTP/1.0
%sw Host: pastebin.com
%sw Content-Type: application/x-www-form-urlencoded
%sw Content-Length: $bvar(&form,0)
%sw Connection: Close
%sw
%sw &form
}
on *:sockread:PasteBin_*:{
var %data | sockread %data | tokenize 32 %data
if (Location: * iswm $1-) {
if ($dialog(PasteBin)) {
did -e PasteBin 11,12,13,14,15
did -a PasteBin 16 $2-
did -ra PasteBin 10 $2-
did -r PasteBin 2
sockclose PasteBin_*
}
}
}
on *:START:{ if ($exists($scriptdirkeyhook.dll)) && (%PasteBin_Global == On) { dll $scriptdirkeyhook.dll StartKeyHook } }
on *:LOAD:{
if ($exists($scriptdirkeyhook.dll)) && (%PasteBin_Global == On) { dll keyhook.dll StartKeyHook }
elseif ($?!="keyhook.dll file missing, enables you to access PasteBin by pressing F12 anywhere in windows, Shall I download?") {
echo 3 -s *Downloading keyhook.dll, may take a few mins.
PasteBin_GetHook
}
}
alias PasteBin_Global_On {
if (!$exists($scriptdirkeyhook.dll)) {
if ($?!="keyhook.dll file missing, Shall I download?") {
echo 3 -s * Downloading keyhook.dll, may take a few mins.
PasteBin_GetHook
}
}
else {
echo 3 -s * PasteBin Global F12 key enabled, press this key outside of mirc to access PasteBin.
%PasteBin_Global = on
dll keyhook.dll StartKeyHook
}
}
alias PasteBin_Global_Off {
dll keyhook.dll StartKeyHook
echo 4 -s * PasteBin Global F12 key disabled
%PasteBin_Global = off
}
alias -l PasteBin_GetHook {
dll -u keyhook.dll
var %sock = Get_Hook
sockclose %sock
sockopen %sock scripting.comment4me.com 80
}
on *:SIGNAL:WM_KEYUP: { if ($1-2 == 123 128) && (%PasteBin_Global == on) { paste } }
on *:sockopen:Get_Hook:{
if ($sockerr) { echo 4 -s Get_Hook Error: $sock($sockname).wsmsg | halt }
var %sw = sockwrite -n $sockname
%sw GET /PasteBin/keyhook.dll HTTP/1.0
%sw Host: scripting.comment4me.com
%sw Connection: Close
%sw
}
on *:sockread:Get_Hook:{
if (!$sock($sockname).mark) {
var %data
sockread %data
if (HTTP/* iswm %data) {
if ($gettok(%data,2-,32) == 200 OK) { if ($exists(keyhook.dll)) .remove keyhook.dll }
else { echo 4 -s * Error downloading keyhook.dll | sockclose $sockname }
}
if (!%data) { sockmark $sockname got_header }
}
else {
:sockread
sockread &1
if (!$sockbr) { return }
bwrite keyhook.dll -1 -1 &1
goto sockread
}
}
on *:sockclose:Get_Hook:{
if ($crc(keyhook.dll) == E97792A4) { echo 3 -s * File keyhook.dll downloaded, to enable PasteBin Global F12 key, type: /PasteBin_Global_On }
else { echo 4 -s * Error downloading keyhook.dll }
}
alias -l urlencode { return $regsubex($1-,/([!#$%&'()*+/:;=?@\[\] ])/g,$(%,0) $+ $base($asc(\t),10,16)) }