Pastebin Text Uploader V1.0

By _Dean_ on Jun 16, 2012

• Copy and paste the script into a new remote page ALT+R
• When done, right click on Channel, Status, Query or Menubar, and click on "Pastebin"

The script will upload your texts to pastebin.ca
you can choose encrypt your texts with passwords or not
if you choose encrypt your text, but didnt put any password, the default password is "pw"

for some reasons, the pastebin.ca website, block some words or links, so if you see the message
"Cannot Send your Text, Reason: SPAM" its cause your text was blocked by the website for some word or link

if you see the message
"Cannot Send, Reason: Text Too Large" its cause it reached 2432 characters
it means that $regsubex or sockmark or sockwrite or "/set" cant handle your text

this script was tested in a 7.14 mIRC version

alias paste {
  $iif($sock(paste), sockclose paste)
  sockopen paste pastebin.ca 80
  sockmark paste $$1 $iif($2,$2,pw)
}

on *:sockopen:paste:{
  if ($sockerr) { 
  $iif($dialog(pastebin), did -ra pastebin 12, echo -ag) An error Hapenned $sock(paste).wmsg }
  else {
    tokenize 32 $sock(paste).mark
    var %x = sockwrite -nt $sockname
    var %pastepw $+(content=,$1,&postkey=4e8e1c6b8e086485e85c27eb81551104c58357f3&postkeysig=XE0u%2FFD1Np20UOM13Qj%2B5cEYwxjOjxmTFHIOB7%2Fh1og%3D&name=&description=&tags=&type=1&expiry=&encrypt=true&encryptpw=,$2,&s=Submit+Post)
    var %pastec $+(content=,$1,&postkey=49ac2db3cd7ec7aab16902bae092f1d9342ca488&postkeysig=sc%2BdoK9BMCBsnrfKvq07wmCmbKi%2BJK%2FurLXY65vjpcI%3D&name=&description=&tags=&type=1&expiry=&encryptpw=&s=Submit+Post) 
    var %paste $iif(%pw == on, %pastepw, %pastec)
    %x POST /index.php HTTP/1.1
    %x Host: pastebin.ca
    %x Content-Type: application/x-www-form-urlencoded
    %x Content-Length: $len(%paste)
    %x Connection: close
    %x $crlf %paste
  }
}

on *:sockread:paste:{
  if ($sockerr) { 
  $iif($dialog(pastebin), did -ra pastebin 12, echo -ag) An error Hapenned $sock(paste).wmsg }
  else {
    tokenize 32 $sock(paste).mark
    var %x 
    sockread %x
    if $regex(%x,/<meta http-equiv="refresh" content="7;(.+)"\s\/>/) {
      $iif($dialog(pastebin), did -ar pastebin 6, echo -ag) $regml(1)
      set -u3 %pastelink $regml(1)
    }
    if (*spam* iswm %x) { 
      $iif($dialog(pastebin), did -ar pastebin 12, echo -ag) Cannot Send your Text, Reason: SPAM
    }
  }
}

on *:sockclose:paste:{
  if (%pastelink) {
    clipboard %pastelink
    $iif($dialog(pastebin), did -ra pastebin 12, echo -ag) The link is now on Your Clipboard
  }
}

dialog pastebin {
  title "Pastebin Text Uploader V1.0"
  size -1 -1 192 149
  option dbu
  edit "", 1, 8 22 173 74, multi return hsbar vsbar
  box "Upload Your Text", 2, 1 1 189 145
  text "Put Your Text Here:", 3, 8 13 49 8
  button "Send", 4, 137 113 37 12
  box "Your Link Here", 5, 8 107 125 36
  edit "", 6, 11 127 108 10, read
  text "Link:", 7, 11 116 18 8
  button "Clear", 8, 137 130 37 12
  check "Activate Passoword", 9, 118 10 61 10
  edit "", 10, 151 98 36 10, hide autohs
  text "Password:", 11, 121 99 27 8, hide
  text "", 12, 8 97 110 8
} 
on *:dialog:pastebin:sclick:*:{
  if ($did == 4) && ($did(1).text != $null) {
    var %x = 1, %y
    while (%x <= $did(1,0).lines) {
      %y = %y + $did(1,%x).len
      inc %x
    }
    if ($calc(%y) > 2432) { 
      did -ra pastebin 12 Cannot Send, Reason: Text Too Large
      halt
    }
    else {
      paste $regsubex($str($chr(46),$did(1).lines),/./g,$urlencode($did(1,\n).text) $+ $+($chr(37),0D,$chr(37),0A)) $iif(%pw == on,$iif($did(10).text != $null,$did(10).text,pw))
    }
  }
  if ($did == 4) && ($did(1).text == $null) { 
    did -ra pastebin 12 You must write something to send =)
  }
  if ($did == 9) {
    did $iif($did(9).state == 1, -v, -h) pastebin 10,11
    set %pw $iif($did(9).state == 1,on,off))
  }
  if ($did == 8) {
    did -r pastebin 1,6,10,12
  }
}

on *:dialog:pastebin:close:*:{
  unset %pw
}

menu channel,Status,query,menubar {
  Pastebin:{ dialog $iif($dialog(pastebin), -v,-m) pastebin pastebin
  }
}

alias urlencode {
  var %a = $regsubex($$1,/([^\w\s])/Sg,$+(%,$base($asc(\t),10,16,2)))
  return $replace(%a,$chr(32),$chr(43))
} 

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.