Pastebin Uploader

By Paradox-Paradigm on Aug 31, 2012

Screenshots

Uploads text to Pastebin

  • DIalog - Right-click in a channel, status or query window & click 'Pastebin'

  • Alias - Type '/paste' to upload from your clipboard or '/paste {text here}', The script will echo the URL to the active window (Does not write to your mIRC logs)

NOTE You will need to replace 'DEVKEY' on line 10 & 68 with your own key you can get from Here (Need to be logged in to Pastebin.com)

  • Example - api_dev_key=hd7dy7s8si78r3b2k28wd2ys821b1a21&api_option=paste

The script can only upload around 4000 characters

If you want to upload pastes into your account you will need to get an api_user_key, with This Script you can type '/pastelogin {DEVKEY} {Pastebin Account Name} {Pastebin Account Password}' to get an api_user_key, you will then need to add ' $+ &api_user_key= {api_user_key}' to the end of line 10 & 68

  • Example - /pastelogin hd7dy7s8si78r3b2k28wd2ys821b1a21 User247 password1
  • After you get the key you can delete this script
  • The 'Private' paste exposure option is only avaliable with an api_user_key

Alias only version (No dialog) - http://pastebin.com/v6e6Gar4

  • You will still need to replace 'DEVKEY' on line 10 with your own key

Thanks to Saturn for help with the POST method

alias paste {
  sockclose Pastebin
  if (!$1) {
    var %P~ = 1
    while (%P~ <= $cb(0)) && ($len(%Paste) <= 3950) {
      set %Paste %Paste $+ $regsubex($cb(%P~),/([ `@#$%^&+=\[\]{}\\|;'",<>\/?])/g,% $+ $base($asc(\t),10,16)) $+ $crlf
      inc %P~
    }
  }
  set %Paste api_dev_key=__DEVKEY__&api_option=paste&api_paste_code= $+ $iif(!$1,%Paste,$1-)
  set %Paste~ ~
  sockopen Pastebin pastebin.com 80
}

menu channel,status,query {
  Pastebin:dialog -m Pastebin Pastebin
}

dialog Pastebin {
  title "Pastebin"
  size -1 -1 325 265
  option dbu
  edit "", 1, 5 5 315 212, multi vsbar autovs hsbar autohs
  text "Expiration", 2, 15 222 24 8
  combo 3, 42 221 38 10, drop
  text "Exposure", 4, 90 222 22 8
  combo 5, 115 221 32 10, drop
  text "Syntax Highlight", 6, 157 222 39 8
  combo 7, 199 221 81 10, drop
  button "Submit", 8, 10 236 50 24
  text "Title", 9, 70 237 10 8
  edit "", 10, 83 236 109 10, autohs
  text "Pastebin", 11, 70 251 20 8
  edit "", 12, 95 250 97 10, autohs
  check "Clipboard URL Automatically", 13, 200 237 75 8
  check "Message Active Window", 14, 200 251 66 8
  text "", 15, 290 251 31 8, center
}

on *:DIALOG:Pastebin:init:*: {
  didtok Pastebin 3 126 Never~10 Minutes~1 Hour~1 Day~1 Month
  didtok Pastebin 5 126 Public~Unlisted~Private
  didtok Pastebin 7 126 None~4CS~6502 ACME Cross Assembler~6502 Kick Assembler~6502 TASM/64TASS~ABAP~ActionScript~ActionScript 3~Ada~ALGOL 68~Apache Log~AppleScript~APT Sources~ASM (NASM)~ASP~autoconf~Autohotkey~AutoIt~Avisynth~Awk~BASCOM AVR~Bash~Basic4GL~BibTeX~Blitz Basic~BNF~BOO~BrainFuck~C~C for Macs~C Intermediate Language~C#~C++~C++ (with QT extensions)~C: Loadrunner~CAD DCL~CAD Lisp~CFDG~ChaiScript~Clojure~Clone C~Clone C++~CMake~COBOL~CoffeeScript~ColdFusion~CSS~Cuesheet~D~DCS~Delphi~Delphi Prism (Oxygene)~Diff~DIV~DOS~DOT~E~ECMAScript~Eiffel~Email~EPC~Erlang~F#~Falcon~FO Language~Formula One~Fortran~FreeBasic~FreeSWITCH~GAMBAS~Game Maker~GDB~Genero~Genie~GetText~Go~Groovy~GwBasic~Haskell~HicEst~HQ9 Plus~HTML~HTML 5~Icon~IDL~INI file~Inno Script~INTERCAL~IO~J~Java~Java 5~JavaScript~jQuery~KiXtart~Latex~Liberty BASIC~Linden Scripting~Lisp~LLVM~Loco Basic~Logtalk~LOL Code~Lotus Formulas~Lotus Script~LScript~Lua~M68000 Assembler~MagikSF~Make~MapBasic~MatLab~mIRC~MIX Assembler~Modula 2~Modula 3~Motorola 68000 HiSoft Dev~MPASM~MXML~MySQL~newLISP~NullSoft Installer~Oberon 2~Objeck Programming Langua~Objective C~OCalm Brief~OCaml~OpenBSD PACKET FILTER~OpenGL Shading~Openoffice BASIC~Oracle 11~Oracle 8~Oz~Pascal~PAWN~PCRE~Per~Perl~Perl 6~PHP~PHP Brief~Pic 16~Pike~Pixel Bender~PL/SQL~PostgreSQL~POV-Ray~Power Shell~PowerBuilder~ProFTPd~Progress~Prolog~Properties~ProvideX~PureBasic~PyCon~Python~q/kdb+~QBasic~R~Rails~REBOL~REG~Robots~RPM Spec~Ruby~Ruby Gnuplot~SAS~Scala~Scheme~Scilab~SdlBasic~Smalltalk~Smarty~SQL~SystemVerilog~T-SQL~TCL~Tera Term~thinBasic~TypoScript~Unicon~UnrealScript~Vala~VB.NET~VeriLog~VHDL~VIM~Visual Pro Log~VisualBasic~VisualFoxPro~WhiteSpace~WHOIS~Winbatch~XBasic~XML~Xorg Config~XPP~YAML~Z80 Assembler~ZXBasic
  $iif(C isin %Pastebin,did -c Pastebin 13)
  $iif(M isin %Pastebin,did -c Pastebin 14)
  did -o Pastebin 15 1 0-1
  did -c Pastebin 3,5,7 1
}

on *:DIALOG:Pastebin:edit:1: {
  var %P~ = 1
  while (%P~ <= $did(1).lines) {
    var %P- = $calc(%P- + $did(1,%P~).len)
    inc %P~
  }
  did -o Pastebin 15 1 %P- $+ - $+ $did(1).lines
}

on *:DIALOG:Pastebin:sclick:*: {
  if ($did == 8) {
    sockclose Pastebin
    unset %Paste
    var %P~ = 1
    while (%P~ <= $did(1).lines) && ($len(%Paste) <= 3950) {
      set %Paste %Paste $+ $regsubex($did(1,%P~),/( `@#$%^&+=\[\]{}\\|;'",<>\/?])/g,% $+ $base($asc(\t),10,16)) $+ $crlf
      inc %P~
    }
    set %Paste api_dev_key=__DEVKEY__&api_option=paste&api_paste_code= $+ %Paste $+ $iif($did(10),&api_paste_name= $+ $did(10)) $+ $iif($did(7) != None,&api_paste_format= $+ $gettok(None~4cs~6502acme~6502kickass~6502tasm~abap~actionscript~actionscript3~ada~algol68~apache~applescript~apt_sources~asm~asp~autoconf~autohotkey~autoit~avisynth~awk~bascomavr~bash~basic4gl~bibtex~blitzbasic~bnf~boo~bf~c~c_mac~cil~csharp~cpp~cpp-qt~c_loadrunner~caddcl~cadlisp~cfdg~chaiscript~clojure~klonec~klonecpp~cmake~cobol~coffeescript~cfm~css~cuesheet~d~dcs~delphi~oxygene~diff~div~dos~dot~e~ecmascript~eiffel~email~epc~erlang~fsharp~falcon~fo~f1~fortran~freebasic~freeswitch~gambas~gml~gdb~genero~genie~gettext~go~groovy~gwbasic~haskell~hicest~hq9plus~html4strict~html5~icon~idl~ini~inno~intercal~io~j~java~java5~javascript~jquery~kixtart~latex~lb~lsl2~lisp~llvm~locobasic~logtalk~lolcode~lotusformulas~lotusscript~lscript~lua~m68k~magiksf~make~mapbasic~matlab~mirc~mmix~modula2~modula3~68000devpac~mpasm~mxml~mysql~newlisp~text~nsis~oberon2~objeck~objc~ocaml-brief~ocaml~pf~glsl~oobas~oracle11~oracle8~oz~pascal~pawn~pcre~per~perl~perl6~php~php-brief~pic16~pike~pixelbender~plsql~postgresql~povray~powershell~powerbuilder~proftpd~progress~prolog~properties~providex~purebasic~pycon~python~q~qbasic~rsplus~rails~rebol~reg~robots~rpmspec~ruby~gnuplot~sas~scala~scheme~scilab~sdlbasic~smalltalk~smarty~sql~systemverilog~tsql~tcl~teraterm~thinbasic~typoscript~unicon~uscript~vala~vbnet~verilog~vhdl~vim~visualprolog~vb~visualfoxpro~whitespace~whois~winbatch~xbasic~xml~xorg_conf~xpp~yaml~z80~zxbasic,$did(7).sel,126)) $+ $iif($did(5) != Public,&api_paste_private= $+ $calc($did(5).sel -1)) $+ $iif($did(3) != Never,&api_paste_expire_date= $+ $iif($left($remove($did(3),$chr(32)),2) != 10,$v1,10M))
    did -o Pastebin 8 1 Uploading...
    sockopen Pastebin pastebin.com 80
  }
  elseif ($did == 13) {
    set %Pastebin $iif(C isin %Pastebin,$remove(%Pastebin,C),%Pastebin $+ C)
  }
  elseif ($did == 14) {
    set %Pastebin $iif(M isin %Pastebin,$remove(%Pastebin,M),%Pastebin $+ M)
  }
}

on *:SOCKOPEN:Pastebin: {
  sockwrite -n Pastebin POST /api/api_post.php HTTP/1.1
  sockwrite -n Pastebin Host: pastebin.com
  sockwrite -n Pastebin Content-Type: application/x-www-form-urlencoded
  sockwrite -n Pastebin Content-length: $len(%Paste)
  sockwrite Pastebin $crlf
  sockwrite Pastebin %Paste
}

on *:SOCKREAD:Pastebin: {
  var %P
  sockread %P
  while ($sockbr) {
    if (http://pastebin.com/ isin %P) || (Bad API request isin %P) {
      if (%Paste~) {
        echo -ag 4Pastebin: %P
        unset %Paste~        
      }
      else {
        did -o Pastebin 12 1 %P
        did -o Pastebin 8 1 Submit
      }
      $iif((C isin %Pastebin) && (http://pastebin.com/ isin %P),clipboard %P)
      $iif((M isin %Pastebin) && (http://pastebin.com/ isin %P),msg $active %P)
      unset %Paste
      sockclose Pastebin
      return
    }
    sockread %P
  }
}

Comments

Sign in to comment.
sunslayer   -  Aug 31, 2012

nice job, but you could use a binvar to increase the size limit of the uploads

 Respond  
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.