--- /dev/null
+ // //It's 403fication Time!
+ // // Take a picture and add a Megan to it!
+ // //
+ // // Requires Dev Image Library,
+// // //on Pentium III libdevil must be
+ // // recompiled with --disable-ssl2 --disable-ssl3
+ // //
+ // // ~~bicyclesonthemoon
+
+#define INPIX_MUSTARD 1
+#define OUTPIX_MUSTARD 2
+#define MEGPIX_MUSTARD 3
+#define ARGUMENT_MUSTARD 4
+#define SEAISH_MUSTARD 5
+#define ANIMATED_MUSTARD 6
+#define FAIL 900
+#define OK 0
+
+#define MEGPIX "403.png"
+#define XM 553
+#define XA 262
+#define XB 226
+#define YM 395
+#define YA 131
+
+/*#define NPBPIX0 "npb0.png"
+#define X0 411
+#define X01 21
+#define X02 96
+#define Y0 404
+#define Y01 214
+#define Y02 68
+
+#define NPBPIX1 "npb1.png"
+#define X1 411
+#define X11 22
+#define X12 133
+#define Y1 404
+#define Y11 241
+#define Y12 94
+
+#define NPBPIX2 "npb2.png"
+#define X2 411
+#define X21 213
+#define Y2 404
+#define Y21 234*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <IL/il.h>
+
+void mustard(int mustard);
+void loadmeg(const char *path);
+void m403(const char *path);
+int main (int argc, const char *argv[]);
+
+ILuint inPix, outPix, megPix;
+ILboolean q=true;
+ILboolean inH=false;
+ILboolean outH=false;
+ILboolean megH=false;
+ILuint inX, inY, outX, outY;
+ILubyte *newdata;
+
+int main (int argc, const char *argv[])
+{
+ if(argc<3)
+ mustard(ARGUMENT_MUSTARD);
+ if (argc>=4)
+ {
+ if (argv[3][0]=='q' || argv[3][0]=='Q')
+ q=false;
+ }
+
+ ilInit();
+ if(!ilEnable(IL_ORIGIN_SET))mustard(FAIL);
+ if(!ilEnable(IL_FILE_OVERWRITE))mustard(FAIL);
+ ilClearColour(255,255,255,255);
+ ilGenImages(1, &inPix);
+ inH=true;
+ ilBindImage(inPix);
+ if(!ilLoadImage(argv[1]))mustard(INPIX_MUSTARD);
+ if(!ilConvertImage(IL_RGBA,IL_UNSIGNED_BYTE))mustard(INPIX_MUSTARD);
+ //if(!ilConvertPal(IL_PAL_RGBA32))mustard(FAIL);
+
+ inX=ilGetInteger(IL_IMAGE_WIDTH);
+ inY=ilGetInteger(IL_IMAGE_HEIGHT);
+ if(ilGetInteger(IL_NUM_IMAGES)>1)
+ mustard(ANIMATED_MUSTARD);
+
+ m403(argv[2]);
+ //ok
+ mustard(0);
+}
+
+void loadmeg(const char *path)
+{
+ ilGenImages(1, &megPix);
+ megH=true;
+ ilBindImage(megPix);
+ if(!ilLoadImage(path))mustard(MEGPIX_MUSTARD);
+ if(!ilConvertImage(IL_RGBA,IL_UNSIGNED_BYTE))mustard(MEGPIX_MUSTARD);
+}
+
+void m403(const char *path)
+{
+ unsigned long i,j;
+ outX=(inX+XB+6>XM)?(inX+XB+6):XM;
+ outY=(inY+YA+6>YM)?(inY+YA+6):YM;
+ ilGenImages(1, &outPix);
+ outH=true;
+ loadmeg(MEGPIX);
+ newdata=ilGetData();
+ ilBindImage(outPix);
+ if(!ilTexImage(outX,outY,1,4,IL_RGBA,IL_UNSIGNED_BYTE,NULL))mustard(OUTPIX_MUSTARD);
+ if(!ilClearImage())mustard(FAIL);
+
+ ilSetPixels(0,0/**/,0,XM,YM,1,IL_RGBA,IL_UNSIGNED_BYTE,newdata);
+ if(!ilOverlayImage(inPix,((inX/2<XA-XB)?(XA-inX/2):XB),outY-YA-inY,0))mustard(FAIL);
+
+ newdata=ilGetData();
+
+ for(i=0;i<outX;++i)
+ {
+ newdata[4*(i ) ]=0x00;
+ newdata[4*(i )+1]=0x00;
+ newdata[4*(i )+2]=0x00;
+ newdata[4*(i )+3]=0xFF;
+
+ newdata[4*(i+outX ) ]=0x00;
+ newdata[4*(i+outX )+1]=0x00;
+ newdata[4*(i+outX )+2]=0x00;
+ newdata[4*(i+outX )+3]=0xFF;
+
+ newdata[4*(i+outX*(outY-1)) ]=0x00;
+ newdata[4*(i+outX*(outY-1))+1]=0x00;
+ newdata[4*(i+outX*(outY-1))+2]=0x00;
+ newdata[4*(i+outX*(outY-1))+3]=0xFF;
+
+ newdata[4*(i+outX*(outY-2)) ]=0x00;
+ newdata[4*(i+outX*(outY-2))+1]=0x00;
+ newdata[4*(i+outX*(outY-2))+2]=0x00;
+ newdata[4*(i+outX*(outY-2))+3]=0xFF;
+ }
+
+ for(j=2;j<outY-2;++j)
+ {
+ newdata[4*( outX*j) ]=0x00;
+ newdata[4*( outX*j)+1]=0x00;
+ newdata[4*( outX*j)+2]=0x00;
+ newdata[4*( outX*j)+3]=0xFF;
+
+ newdata[4*( 1+outX*j) ]=0x00;
+ newdata[4*( 1+outX*j)+1]=0x00;
+ newdata[4*( 1+outX*j)+2]=0x00;
+ newdata[4*( 1+outX*j)+3]=0xFF;
+
+ newdata[4*(outX-1+outX*j) ]=0x00;
+ newdata[4*(outX-1+outX*j)+1]=0x00;
+ newdata[4*(outX-1+outX*j)+2]=0x00;
+ newdata[4*(outX-1+outX*j)+3]=0xFF;
+
+
+ }
+
+ newdata[4*(outX-1+outX*(outY-1)) ]=0xB6;
+ newdata[4*(outX-1+outX*(outY-1))+1]=0xB6;
+ newdata[4*(outX-1+outX*(outY-1))+2]=0xB6;
+ newdata[4*(outX-1+outX*(outY-1))+3]=0xFF;
+
+ newdata[4*( outX*(outY-1)) ]=0xB6;
+ newdata[4*( outX*(outY-1))+1]=0xB6;
+ newdata[4*( outX*(outY-1))+2]=0xB6;
+ newdata[4*( outX*(outY-1))+3]=0xFF;
+
+ newdata[4*(outX-1 ) ]=0xB6;
+ newdata[4*(outX-1 )+1]=0xB6;
+ newdata[4*(outX-1 )+2]=0xB6;
+ newdata[4*(outX-1 )+3]=0xFF;
+
+ newdata[ 0]=0xB6;
+ newdata[ 1]=0xB6;
+ newdata[ 2]=0xB6;
+ newdata[ 3]=0xFF;
+
+ if(!ilSave(IL_PNG,path))mustard(OUTPIX_MUSTARD);
+}
+
+/*void npbottify2(const char *path)
+{
+
+
+ for(i=outX-X21-inX-2;i<outX-X21+2;++i)
+ {
+ //printf("i=%lu\n",i);
+ for(j=Y21-2;j<Y21+inY+2;++j)
+ {
+ //printf("i=%lu j=%lu\n",i,j);
+ if((i==outX-X21-inX-2)||(i==outX-X21-inX-1)||
+ (i==outX-X21 +1)||(i==outX-X21 )||
+ (j== Y21 -2)||(j== Y21 -1)||
+ (j== Y21+inY+1)||(j== Y21+inY ))
+ {
+ newdata[4*(i+outX*j)+0]=0x00;
+ newdata[4*(i+outX*j)+1]=0x00;
+ newdata[4*(i+outX*j)+2]=0x00;
+ newdata[4*(i+outX*j)+3]=0xFF;
+ }
+ else
+ {
+ newdata[4*(i+outX*j)+0]=0xFF;
+ newdata[4*(i+outX*j)+1]=0xFF;
+ newdata[4*(i+outX*j)+2]=0xFF;
+ newdata[4*(i+outX*j)+3]=0xFF;
+ }
+ }
+ }
+
+
+ //
+
+
+ i=outX-X21-inX-2;
+ j=Y21-2;
+ newdata[4*(i+outX*j)+0]=0x00;
+ newdata[4*(i+outX*j)+1]=0x00;
+ newdata[4*(i+outX*j)+2]=0x00;
+ newdata[4*(i+outX*j)+3]=0x00;
+ j=Y21+inY+1;
+ newdata[4*(i+outX*j)+0]=0x00;
+ newdata[4*(i+outX*j)+1]=0x00;
+ newdata[4*(i+outX*j)+2]=0x00;
+ newdata[4*(i+outX*j)+3]=0x00;
+ i=outX-X21+1;
+ newdata[4*(i+outX*j)+0]=0x00;
+ newdata[4*(i+outX*j)+1]=0x00;
+ newdata[4*(i+outX*j)+2]=0x00;
+ newdata[4*(i+outX*j)+3]=0x00;
+ j=Y21-2;
+ newdata[4*(i+outX*j)+0]=0x00;
+ newdata[4*(i+outX*j)+1]=0x00;
+ newdata[4*(i+outX*j)+2]=0x00;
+ newdata[4*(i+outX*j)+3]=0x00;
+
+ i=outX-X21-inX;
+ j=Y21;
+ newdata[4*(i+outX*j)+0]=0x00;
+ newdata[4*(i+outX*j)+1]=0x00;
+ newdata[4*(i+outX*j)+2]=0x00;
+ newdata[4*(i+outX*j)+3]=0xFF;
+ j=Y21+inY-1;
+ newdata[4*(i+outX*j)+0]=0x00;
+ newdata[4*(i+outX*j)+1]=0x00;
+ newdata[4*(i+outX*j)+2]=0x00;
+ newdata[4*(i+outX*j)+3]=0xFF;
+ i=outX-X21-1;
+ newdata[4*(i+outX*j)+0]=0x00;
+ newdata[4*(i+outX*j)+1]=0x00;
+ newdata[4*(i+outX*j)+2]=0x00;
+ newdata[4*(i+outX*j)+3]=0xFF;
+ j=Y21;
+ newdata[4*(i+outX*j)+0]=0x00;
+ newdata[4*(i+outX*j)+1]=0x00;
+ newdata[4*(i+outX*j)+2]=0x00;
+ newdata[4*(i+outX*j)+3]=0xFF;
+
+
+
+
+}*/
+
+void mustard(int mustard)
+{
+ switch(mustard)
+ {
+ case 0:
+ if(q) printf("403fied!\n");break;
+ case ARGUMENT_MUSTARD:
+ if(q) printf("npb inPix outPix [q]\n");break;
+ case INPIX_MUSTARD:
+ if(q) printf("inPIX mustard.\n");break;
+ case OUTPIX_MUSTARD:
+ if(q) printf("outPIX mustard.\n");break;
+ case MEGPIX_MUSTARD:
+ if(q) printf("megPIX mustard.\n");break;
+ case SEAISH_MUSTARD:
+ if(q) printf("Seaishness is mustard.\n");break;
+ case ANIMATED_MUSTARD:
+ if(q) printf("Animation is mustard.\n");break;
+ default:
+ if (q) printf("Ch*rpin* mustard mustaard!\n");
+ }
+ if(inH)
+ ilDeleteImages(1, &inPix);
+ if(outH)
+ {
+ ilDeleteImages(1, &outPix);
+ //delete[] newdata;
+ }
+ if(megH)
+ ilDeleteImages(1, &megPix);
+ exit(mustard);
+}
+
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
+<html lang="pl">
+ <head>
+ <title>It's 403fication time! • Bicycles on the Moon</title>
+ <meta http-equiv="Content-type" content="text/html; charset=iso-8859-2">
+ <link rel="icon" type="image/png" href="/img/favicon.png"/>
+ </head>
+ <body>
+ <a href="/"><img src="/img/botmlogo2.png" alt="1190.bicyclesonthemoon.dnsd.info" border="0"></a>
+ <h1>It's 403fication time!</h1>
+ <form method="post" action="/cgi/npb/npbd/403">
+ 403 by URL<br>
+ URL of image:
+ <input type="text" name="inpix">
+ <input type="submit" value="403">
+ </form>
+ <br>
+ <form method="post" action="/cgi/npb/npbd/403" enctype="multipart/form-data">
+ 403 by file upload<br>
+ Upload the image:
+ <input type="file" name="inpix">
+ <input type="submit" value="403">
+ </form>
+ <br>
+ Source code available at <a href="svn://bicyclesonthemoon.dnsd.info/npb">svn://bicyclesonthemoon.dnsd.info/npb</a> (use "e" to login) or <a href="http://1190.bicyclesonthemoon.dnsd.info/pro/npb">http://1190.bicyclesonthemoon.dnsd.info/pro/npb</a>.
+
+ </body>
+</html>
--- /dev/null
+ // //bluenhance
+ // // ENHANCE the bluepix!
+ // //
+ // // Requires Dev Image Library,
+// // //on Pentium III libdevil must be
+ // // recompiled with --disable-ssl2 --disable-ssl3
+ // //
+ // // ~~bicyclesonthemoon
+
+#define INPIX_MUSTARD 1
+#define OUTPIX_MUSTARD 2
+
+#define ARGUMENT_MUSTARD 4
+
+#define ANIMATED_MUSTARD 6
+#define FAIL 900
+#define OK 0
+
+#define CR newdata[4*(i+inX*j)+0]
+#define CG newdata[4*(i+inX*j)+1]
+#define CB newdata[4*(i+inX*j)+2]
+
+#define A ((long)(a))
+#define B ((long)(b))
+#define C ((long)(c))
+#define D ((long)(d))
+#define E ((long)(e))
+#define F ((long)(f))
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <IL/il.h>
+
+void mustard(int mustard);
+ILubyte enhance(ILubyte x, long r, long s, long t);
+ILubyte enhance2(ILubyte x, ILubyte a, ILubyte b, ILubyte c, ILubyte d, ILubyte e, ILubyte f);
+ILubyte enhance3(ILubyte x, ILubyte a, ILubyte b, ILubyte c);
+int main (int argc, const char *argv[]);
+
+ILuint pix;
+ILboolean q=true;
+ILboolean pixOpen=false;
+
+
+ILubyte enhance(ILubyte x, long r, long s, long t)
+{
+ long y=(r*x+t)/s;
+ return (ILubyte)((y>255)?255:((y<0)?0:y));
+}
+
+ILubyte enhance2(ILubyte x, ILubyte a, ILubyte b, ILubyte c, ILubyte d, ILubyte e, ILubyte f)
+{
+ return ((x<=a)?d:((x>=c)?f:((x>b)?(enhance(x,F-E,C-B,E*C-B*F)):((x<b)?(enhance(x,E-D,B-A,D*B-A*E)):e))));
+}
+
+ILubyte enhance3(ILubyte x, ILubyte a, ILubyte b, ILubyte c)
+{
+ return enhance(x,C-A,B-A,(B-C)*A);
+}
+
+int main (int argc, const char *argv[])
+{
+ ILubyte a,b,c,d,e,f,g;
+ ILubyte *h, *s, *l;
+ ILuint inX, inY;
+ ILubyte *newdata;
+
+ if(argc<9)
+ mustard(ARGUMENT_MUSTARD);
+ if (argc>=10)
+ {
+ if (argv[9][0]=='q' || argv[9][0]=='Q')
+ q=false;
+ }
+
+ sscanf(argv[3],"%hhu",&a);
+ sscanf(argv[4],"%hhu",&b);
+ sscanf(argv[5],"%hhu",&c);
+ sscanf(argv[6],"%hhu",&d);
+ sscanf(argv[7],"%hhu",&e);
+ sscanf(argv[8],"%hhu",&f);
+
+ ilInit();
+ if(!ilEnable(IL_ORIGIN_SET))mustard(FAIL);
+ if(!ilEnable(IL_FILE_OVERWRITE))mustard(FAIL);
+ ilClearColour(255,255,0,0);
+ ilGenImages(1, &pix);
+ pixOpen=true;
+ ilBindImage(pix);
+ if(!ilLoadImage(argv[1]))mustard(INPIX_MUSTARD);
+ if(!ilConvertImage(IL_RGBA,IL_UNSIGNED_BYTE))mustard(INPIX_MUSTARD);
+
+ inX=ilGetInteger(IL_IMAGE_WIDTH);
+ inY=ilGetInteger(IL_IMAGE_HEIGHT);
+ if(ilGetInteger(IL_NUM_IMAGES)>1)
+ mustard(ANIMATED_MUSTARD);
+
+ newdata=ilGetData();
+ for(unsigned long i=0;i<inX;++i)
+ {
+ for(unsigned long j=0;j<inY;++j)
+ {
+ if(CR==CG&&CG==CB)
+ continue;
+ //it'll stilll work correctly if two are equal.
+ if(CR>CG)
+ {
+ if(CG>CB)
+ {
+ h=&(CR);
+ s=&(CG);
+ l=&(CB);
+ }
+ else if(CB>CR)
+ {
+ h=&(CB);
+ s=&(CR);
+ l=&(CG);
+ }
+ else
+ {
+ h=&(CR);
+ s=&(CB);
+ l=&(CG);
+ }
+ }
+ else
+ {
+ if(CR>CB)
+ {
+ h=&(CG);
+ s=&(CR);
+ l=&(CB);
+ }
+ else if(CB>CG)
+ {
+ h=&(CB);
+ s=&(CG);
+ l=&(CR);
+ }
+ else
+ {
+ h=&(CG);
+ s=&(CB);
+ l=&(CR);
+ }
+ }
+ g=*h;
+ *h=enhance2(*h,a,b,c,d,e,f);
+ *s=enhance3(*s,*l,g,*h);
+ }
+ }
+ if(!ilSave(IL_PNG,argv[2]))mustard(OUTPIX_MUSTARD);
+ // no mustard
+ mustard(0);
+}
+
+void mustard(int mustard)
+{
+ switch(mustard)
+ {
+ case 0:
+ if(q) printf("ENHANCED!\n");break;
+ case ARGUMENT_MUSTARD:
+ if(q) printf("bluenhanced inPix outPix a b c d e f [q]\n");break;
+ case INPIX_MUSTARD:
+ if(q) printf("inPIX mustard.\n");break;
+ case OUTPIX_MUSTARD:
+ if(q) printf("outPIX mustard.\n");break;
+ case ANIMATED_MUSTARD:
+ if(q) printf("Animation is mustard.\n");break;
+ default:
+ if (q) printf("Ch*rpin* mustard mustaard!\n");
+ }
+ if(pixOpen)
+ ilDeleteImages(1, &pix);
+ exit(mustard);
+}
+
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
+<html lang="pl">
+ <head>
+ <title>ENHANCE! • Bicycles on the Moon</title>
+ <meta http-equiv="Content-type" content="text/html; charset=iso-8859-2">
+ <link rel="icon" type="image/png" href="/img/favicon.png">
+ </head>
+ <body>
+ <a href="/"><img src="/img/botmlogo2.png" alt="1190.bicyclesonthemoon.dnsd.info" border="0"></a>
+ <h1>ENHANCE!</h1>
+ <form method="post" action="/cgi/bluenh/bluenhd" enctype='multipart/form-data'>
+ <img src="param.png" alt="parameter explanation picture"><br>
+ <br>
+ a=<input type="text" name="a" value= "0">, b=<input type="text" name="b" value= "34">, c=<input type="text" name="c" value= "41">,<br>
+ d=<input type="text" name="d" value= "0">, e=<input type="text" name="e" value= "40">, f=<input type="text" name="f" value="255">.<br>
+ a < b < c<br>
+ <br>
+ Enhance by URL<br>
+ URL of image:
+ <input type="text" name="inpix">
+ <input type="submit" value="ENHANCE!"><br>
+ <br>
+ Enhance by file upload<br>
+ Upload the image:
+ <input type="file" name="inpix2">
+ <input type="submit" value="ENHANCE!">
+ </form>
+ <br>
+ <br>
+ Source code available at <a href="svn://bicyclesonthemoon.dnsd.info/bluenh">svn://bicyclesonthemoon.dnsd.info/bluenh</a> (use "e" to login) or <a href="http://1190.bicyclesonthemoon.dnsd.info/pro/bluenh">http://1190.bicyclesonthemoon.dnsd.info/pro/bluenh</a>.
+
+ </body>
+</html>
--- /dev/null
+// // //Download images and
+ // // ENHANCE them!
+ // //
+ // // Requires cgilib
+// // //line 146 of cgi.h
+ // // must be changed
+ // // from "extern }"
+ // // to "}"
+// // //
+ // // ~~bicyclesonthemoon
+
+#include <cgi.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
+
+#define WGET_PATH "/usr/bin/wget"
+#define ENH_PATH "./bluenh"
+#define ENH_PATH2 "./bluenh2"
+#define RM_PATH "/bin/rm"
+#define LOG_PATH "/eizm/log/bluenh/bluenh.log"
+#define USERAGENT "Bluenhancement\x20(1190.bicyclesonthemoon.dnsd.info/bluenh/bluenh.htm)"
+#define MSTD_PATH "/pro/bluenh/nh.png"
+
+int main (int argc, char *argv[]);
+void mustard(int mustard);
+
+FILE *pix;
+
+char url[1024];
+char path[256];
+s_cgi *cgi;
+int t;
+pid_t sub;
+
+int main (int argc, char *argv[])
+{
+ unsigned char buf[1024];
+ struct stat st;
+ unsigned long p;
+ unsigned short q;
+ char **up;
+ bool enh2;
+
+ cgi=cgiInit();
+
+ up=cgiGetFiles(cgi);
+ if (up)
+ {
+ sprintf(path,"%s",cgiGetFile(cgi,up[0])->tmpfile);
+ sprintf(url,"%s",cgiGetFile(cgi,up[0])->filename);
+ }
+ else
+ {
+ sprintf(url,"%s",(cgiGetValue(cgi,"inpix")!=NULL)?(cgiGetValue(cgi,"inpix")):"");
+ sprintf(path,"/var/tmp/%lu",(unsigned long)getpid());
+
+ //Why is there no spawnl() in linux?
+ sub=fork();
+ if(sub==0)
+ {
+ t=execl(WGET_PATH,WGET_PATH,"-q","-t","2","-U",USERAGENT,"-O",path,url,(char *)0);
+ exit(t);
+ }
+ waitpid(sub,&t,0);
+ if(t)mustard(t);
+ }
+
+ enh2=(cgiGetValue(cgi,"bluenh2")!=NULL);
+ sub=fork();
+ if(sub==0)
+ {
+ t=execl(enh2?ENH_PATH2:ENH_PATH,enh2?ENH_PATH2:ENH_PATH,path,path,cgiGetValue(cgi,"a")!=NULL?cgiGetValue(cgi,"a"):"0",cgiGetValue(cgi,"b")!=NULL?cgiGetValue(cgi,"b"):"127",cgiGetValue(cgi,"c")!=NULL?cgiGetValue(cgi,"c"):"255",cgiGetValue(cgi,"d")!=NULL?cgiGetValue(cgi,"d"):"0",cgiGetValue(cgi,"e")!=NULL?cgiGetValue(cgi,"e"):"127",cgiGetValue(cgi,"f")!=NULL?cgiGetValue(cgi,"f"):"255","q",(char *)0);
+ exit(t);
+ }
+ waitpid(sub,&t,0);
+ if(t)mustard(t);
+
+ pix=fopen(path,"rb");
+ if(pix==NULL)
+ mustard(123);
+ fstat(fileno(pix),&st);
+ p=st.st_size/1024;
+ q=st.st_size%1024;
+
+ printf("Content-Length: %lu\n",(unsigned long)(st.st_size));
+ printf("Content-type: image/png\n\n");
+ for(unsigned long i=0;i<p;++i)
+ {
+ fread(buf,1,1024,pix);
+ fwrite(buf,1,1024,stdout);
+ }
+ if(q!=0)
+ {
+ fread(buf,1,q,pix);
+ fwrite(buf,1,q,stdout);
+ }
+ fclose(pix);
+ fflush(stdout);
+ mustard(0);//no mustard
+}
+
+void mustard(int mustard)
+{
+ if(mustard)
+ {
+ cgiRedirect(MSTD_PATH);
+ }
+ sub=fork();
+ if(sub==0)
+ {
+ t=execl(RM_PATH,RM_PATH,"-f",path,(char *)0);
+ exit(t);
+ }
+ waitpid(sub,&t,0);
+ pix=fopen(LOG_PATH,"at");
+ if(pix!=NULL)
+ {
+ fprintf(pix,"%x %s\n",mustard,url);
+ fclose(pix);
+ }
+ exit(mustard);
+}
\ No newline at end of file
--- /dev/null
+CC=g++
+CF=-g -Wall
+LF=-lIL
+LF2=-lcgi
+
+all: 403 npb npbd npb-ong1 npbd-ong1 bluenh bluenhd
+
+npb: npb-ong1.cpp makefile
+ $(CC) $(CF) $(LF) -o npb-ong1 npb-ong1.cpp
+
+npb: npb.cpp makefile
+ $(CC) $(CF) $(LF) -o npb npb.cpp
+
+403: 403.cpp makefile
+ $(CC) $(CF) $(LF) -o 403 403.cpp
+
+npbd-ong1: npb npbd-ong1.cpp makefile
+ $(CC) $(CF) -o npbd-ong1 npbd-ong1.cpp $(LF2)
+
+npbd: npb npbd.cpp makefile
+ $(CC) $(CF) -o npbd npbd.cpp $(LF2)
+
+bluenh: bluenh.cpp makefile
+ $(CC) $(CF) $(LF) -o bluenh bluenh.cpp
+
+bluenhd: bluenhd.cpp makefile
+ $(CC) $(CF) -o bluenhd bluenhd.cpp $(LF2)
--- /dev/null
+// npb.cpp
+// NewpixbOTTification - The tool to add newpixbots to pictures
+// 16.01.2015
+//
+// Copyright (C) 2013 Balthasar SzczepaĆski
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+
+// Requires Dev Image Library (libdevil) (http://openil.sourceforge.net/)
+// on Pentium III libdevil must be recompiled with
+// --disable-ssl2 --disable-ssl3
+// (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=572954)
+
+#define INPIX_MUSTARD 1
+#define OUTPIX_MUSTARD 2
+#define NPBPIX_MUSTARD 3
+#define ARGUMENT_MUSTARD 4
+#define SEAISH_MUSTARD 5
+#define ANIMATED_MUSTARD 6
+#define FAIL 900
+#define OK 0
+
+#define NPBPIX2 "/eizm/mem/ong1/npb.png"
+#define X2 311
+#define X21 210
+#define Y2 475
+#define Y21 407
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <IL/il.h>
+
+void mustard(int mustard);
+void loadnpb(const char *path);
+void npbottify0(const char *path);
+void npbottify1(const char *path);
+void npbottify2(const char *path);
+int main (int argc, const char *argv[]);
+
+ILuint inPix, outPix, npbPix;
+ILboolean q=true;
+ILboolean inH=false;
+ILboolean outH=false;
+ILboolean npbH=false;
+ILuint inX, inY, outX, outY;
+ILubyte *newdata;
+
+int main (int argc, const char *argv[])
+{
+ if(argc<3)
+ mustard(ARGUMENT_MUSTARD);
+ if (argc>=4)
+ {
+ if (argv[3][0]=='q' || argv[3][0]=='Q')
+ q=false;
+ }
+
+ ilInit();
+ if(!ilEnable(IL_ORIGIN_SET))mustard(FAIL);
+ if(!ilEnable(IL_FILE_OVERWRITE))mustard(FAIL);
+ ilClearColour(255,255,0,0);
+ ilGenImages(1, &inPix);
+ inH=true;
+ ilBindImage(inPix);
+ if(!ilLoadImage(argv[1]))mustard(INPIX_MUSTARD);
+ if(!ilConvertImage(IL_RGBA,IL_UNSIGNED_BYTE))mustard(INPIX_MUSTARD);
+ //if(!ilConvertPal(IL_PAL_RGBA32))mustard(FAIL);
+
+ inX=ilGetInteger(IL_IMAGE_WIDTH);
+ inY=ilGetInteger(IL_IMAGE_HEIGHT);
+ if(ilGetInteger(IL_NUM_IMAGES)>1)
+ mustard(ANIMATED_MUSTARD);
+
+ // if(inX<=X02&&inY<=Y02)
+ // npbottify0(argv[2]);
+ // else if(inX<=X12&&inY<=Y12)
+ // npbottify1(argv[2]);
+ else
+ npbottify2(argv[2]);
+ //ok
+ mustard(0);
+}
+
+void loadnpb(const char *path)
+{
+ ilGenImages(1, &npbPix);
+ npbH=true;
+ ilBindImage(npbPix);
+ if(!ilLoadImage(path))mustard(NPBPIX_MUSTARD);
+ if(!ilConvertImage(IL_RGBA,IL_UNSIGNED_BYTE))mustard(NPBPIX_MUSTARD);
+ }
+
+void npbottify2(const char *path)
+{
+ unsigned long i,j;
+ outX=(X21+inX+2>X2)?(X21+inX+2):X2;
+ outY=(Y21+inY+2>Y2)?(Y21+inY+2):Y2;
+ ilGenImages(1, &outPix);
+ outH=true;
+ loadnpb(NPBPIX2);
+ newdata=ilGetData();
+ ilBindImage(outPix);
+ if(!ilTexImage(outX,outY,1,4,IL_RGBA,IL_UNSIGNED_BYTE,NULL))mustard(OUTPIX_MUSTARD);
+ if(!ilClearImage())mustard(FAIL);
+ ilSetPixels(outX-X2,0,0,X2,Y2,1,IL_RGBA,IL_UNSIGNED_BYTE,newdata);
+ newdata=ilGetData();
+ for(i=outX-X21-inX-2;i<outX-X21+2;++i)
+ {
+ //printf("i=%lu\n",i);
+ for(j=Y21-2;j<Y21+inY+2;++j)
+ {
+ //printf("i=%lu j=%lu\n",i,j);
+ if((i==outX-X21-inX-2)||(i==outX-X21-inX-1)||
+ (i==outX-X21 +1)||(i==outX-X21 )||
+ (j== Y21 -2)||(j== Y21 -1)||
+ (j== Y21+inY+1)||(j== Y21+inY ))
+ {
+ newdata[4*(i+outX*j)+0]=0x00;
+ newdata[4*(i+outX*j)+1]=0x00;
+ newdata[4*(i+outX*j)+2]=0x00;
+ newdata[4*(i+outX*j)+3]=0xFF;
+ }
+ else
+ {
+ newdata[4*(i+outX*j)+0]=0xFF;
+ newdata[4*(i+outX*j)+1]=0xFF;
+ newdata[4*(i+outX*j)+2]=0xFF;
+ newdata[4*(i+outX*j)+3]=0xFF;
+ }
+ }
+ }
+
+ if(!ilOverlayImage(inPix,outX-X21-inX,outY-Y21-inY,0))mustard(FAIL);
+
+ // i=outX-X21-inX-2;
+ // j=Y21-2;
+ // newdata[4*(i+outX*j)+0]=0x00;
+ // newdata[4*(i+outX*j)+1]=0x00;
+ // newdata[4*(i+outX*j)+2]=0x00;
+ // newdata[4*(i+outX*j)+3]=0x00;
+ // j=Y21+inY+1;
+ // newdata[4*(i+outX*j)+0]=0x00;
+ // newdata[4*(i+outX*j)+1]=0x00;
+ // newdata[4*(i+outX*j)+2]=0x00;
+ // newdata[4*(i+outX*j)+3]=0x00;
+ // i=outX-X21+1;
+ // newdata[4*(i+outX*j)+0]=0x00;
+ // newdata[4*(i+outX*j)+1]=0x00;
+ // newdata[4*(i+outX*j)+2]=0x00;
+ // newdata[4*(i+outX*j)+3]=0x00;
+ // j=Y21-2;
+ // newdata[4*(i+outX*j)+0]=0x00;
+ // newdata[4*(i+outX*j)+1]=0x00;
+ // newdata[4*(i+outX*j)+2]=0x00;
+ // newdata[4*(i+outX*j)+3]=0x00;
+
+ // i=outX-X21-inX;
+ // j=Y21;
+ // newdata[4*(i+outX*j)+0]=0x00;
+ // newdata[4*(i+outX*j)+1]=0x00;
+ // newdata[4*(i+outX*j)+2]=0x00;
+ // newdata[4*(i+outX*j)+3]=0xFF;
+ // j=Y21+inY-1;
+ // newdata[4*(i+outX*j)+0]=0x00;
+ // newdata[4*(i+outX*j)+1]=0x00;
+ // newdata[4*(i+outX*j)+2]=0x00;
+ // newdata[4*(i+outX*j)+3]=0xFF;
+ // i=outX-X21-1;
+ // newdata[4*(i+outX*j)+0]=0x00;
+ // newdata[4*(i+outX*j)+1]=0x00;
+ // newdata[4*(i+outX*j)+2]=0x00;
+ // newdata[4*(i+outX*j)+3]=0xFF;
+ // j=Y21;
+ // newdata[4*(i+outX*j)+0]=0x00;
+ // newdata[4*(i+outX*j)+1]=0x00;
+ // newdata[4*(i+outX*j)+2]=0x00;
+ // newdata[4*(i+outX*j)+3]=0xFF;
+
+ ilGenImages(1, &npbPix);
+ npbH=true;
+ ilBindImage(npbPix);
+ if(!ilLoadImage(NPBPIX2))mustard(NPBPIX_MUSTARD);
+ if(!ilConvertImage(IL_RGBA,IL_UNSIGNED_BYTE))mustard(NPBPIX_MUSTARD);
+ ilBindImage(outPix);
+ if(!ilOverlayImage(npbPix,outX-X2,outY-Y2,0))mustard(FAIL);
+ //ilSetPixels(outX-X2,0,0,X2,Y2,1,IL_RGBA,IL_UNSIGNED_BYTE,newdata);
+
+ if(!ilSave(IL_PNG,path))mustard(OUTPIX_MUSTARD);
+
+
+}
+
+void mustard(int mustard)
+{
+ switch(mustard)
+ {
+ case 0:
+ if(q) printf("NewpixbOTTified!\n");break;
+ case ARGUMENT_MUSTARD:
+ if(q) printf("npb inPix outPix [q]\n");break;
+ case INPIX_MUSTARD:
+ if(q) printf("inPIX mustard.\n");break;
+ case OUTPIX_MUSTARD:
+ if(q) printf("outPIX mustard.\n");break;
+ case NPBPIX_MUSTARD:
+ if(q) printf("npbPIX mustard.\n");break;
+ case SEAISH_MUSTARD:
+ if(q) printf("Seaishness is mustard.\n");break;
+ case ANIMATED_MUSTARD:
+ if(q) printf("Animation is mustard.\n");break;
+ default:
+ if (q) printf("Ch*rpin* mustard mustaard!\n");
+ }
+ if(inH)
+ ilDeleteImages(1, &inPix);
+ if(outH)
+ {
+ ilDeleteImages(1, &outPix);
+ //delete[] newdata;
+ }
+ if(npbH)
+ ilDeleteImages(1, &npbPix);
+ exit(mustard);
+}
+
--- /dev/null
+ // //It's NewpixbOTTification Time!
+ // // Take a picture and add a newpixbot to it!
+ // //
+ // // Requires Dev Image Library,
+// // //on Pentium III libdevil must be
+ // // recompiled with --disable-ssl2 --disable-ssl3
+ // //
+ // // ~~bicyclesonthemoon
+
+#define INPIX_MUSTARD 1
+#define OUTPIX_MUSTARD 2
+#define NPBPIX_MUSTARD 3
+#define ARGUMENT_MUSTARD 4
+#define SEAISH_MUSTARD 5
+#define ANIMATED_MUSTARD 6
+#define FAIL 900
+#define OK 0
+
+#define NPBPIX0 "npb0.png"
+#define X0 411
+#define X01 21
+#define X02 96
+#define Y0 404
+#define Y01 214
+#define Y02 68
+
+#define NPBPIX1 "npb1.png"
+#define X1 411
+#define X11 22
+#define X12 133
+#define Y1 404
+#define Y11 241
+#define Y12 94
+
+#define NPBPIX2 "npb2.png"
+#define X2 411
+#define X21 213
+#define Y2 404
+#define Y21 234
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <IL/il.h>
+
+void mustard(int mustard);
+void loadnpb(const char *path);
+void npbottify0(const char *path);
+void npbottify1(const char *path);
+void npbottify2(const char *path);
+int main (int argc, const char *argv[]);
+
+ILuint inPix, outPix, npbPix;
+ILboolean q=true;
+ILboolean inH=false;
+ILboolean outH=false;
+ILboolean npbH=false;
+ILuint inX, inY, outX, outY;
+ILubyte *newdata;
+
+int main (int argc, const char *argv[])
+{
+ if(argc<3)
+ mustard(ARGUMENT_MUSTARD);
+ if (argc>=4)
+ {
+ if (argv[3][0]=='q' || argv[3][0]=='Q')
+ q=false;
+ }
+
+ ilInit();
+ if(!ilEnable(IL_ORIGIN_SET))mustard(FAIL);
+ if(!ilEnable(IL_FILE_OVERWRITE))mustard(FAIL);
+ ilClearColour(255,255,0,0);
+ ilGenImages(1, &inPix);
+ inH=true;
+ ilBindImage(inPix);
+ if(!ilLoadImage(argv[1]))mustard(INPIX_MUSTARD);
+ if(!ilConvertImage(IL_RGBA,IL_UNSIGNED_BYTE))mustard(INPIX_MUSTARD);
+ //if(!ilConvertPal(IL_PAL_RGBA32))mustard(FAIL);
+
+ inX=ilGetInteger(IL_IMAGE_WIDTH);
+ inY=ilGetInteger(IL_IMAGE_HEIGHT);
+ if(ilGetInteger(IL_NUM_IMAGES)>1)
+ mustard(ANIMATED_MUSTARD);
+
+ if(inX<=X02&&inY<=Y02)
+ npbottify0(argv[2]);
+ else if(inX<=X12&&inY<=Y12)
+ npbottify1(argv[2]);
+ else
+ npbottify2(argv[2]);
+ //ok
+ mustard(0);
+}
+
+void loadnpb(const char *path)
+{
+ ilGenImages(1, &npbPix);
+ npbH=true;
+ ilBindImage(npbPix);
+ if(!ilLoadImage(path))mustard(NPBPIX_MUSTARD);
+ if(!ilConvertImage(IL_RGBA,IL_UNSIGNED_BYTE))mustard(NPBPIX_MUSTARD);
+}
+
+void npbottify0(const char *path)
+{
+ //newdata= new ILubyte[X0*Y0*4];
+ ilGenImages(1, &outPix);
+ outH=true;
+ loadnpb(NPBPIX0);
+ ilBindImage(outPix);
+ if(!ilCopyImage(npbPix))mustard(FAIL);
+ //if(!ilTexImage(X0,Y0,1,4,IL_RGBA,IL_UNSIGNED_BYTE,NULL))mustard(OUTPIX_MUSTARD);
+ //if(!ilConvertImage(IL_RGBA,IL_UNSIGNED_BYTE))mustard(OUTPIX_MUSTARD);
+ newdata=ilGetData();
+ for(unsigned long i=0;i<X0;++i)
+ {
+ for(unsigned long j=0;j<Y0;++j)
+ {
+ if((i>=X01+(X02-inX)/2)&&
+ (i< X01+(X02-inX)/2+inX)&&
+ (j>=Y01+(Y02-inY)/2)&&
+ (j< Y01+(Y02-inY)/2+inY))
+ {
+ newdata[4*(i+X0*j)+0]=0xFF;
+ newdata[4*(i+X0*j)+1]=0xFF;
+ newdata[4*(i+X0*j)+2]=0xFF;
+ newdata[4*(i+X0*j)+3]=0xFF;
+ }
+ else if((i>=X01)&&(i<X01+X02)&&
+ (j>=Y01)&&(j<Y01+Y02))
+ {
+ newdata[4*(i+X0*j)+0]=0xFF;//looks better white
+ newdata[4*(i+X0*j)+1]=0xFF;
+ newdata[4*(i+X0*j)+2]=0xFF;
+ newdata[4*(i+X0*j)+3]=0xFF;
+ }
+ else
+ {
+ //newdata[4*(i+X0*j)+0]=0xFF;
+ //newdata[4*(i+X0*j)+1]=0xFF;
+ //newdata[4*(i+X0*j)+2]=0xFF;
+ //newdata[4*(i+X0*j)+3]=0x00;
+ }
+ }
+ }
+ //if(!ilSetData(newdata))mustard(OUTPIX_MUSTARD);
+
+ //printf("%d\n",iCurImage);
+ if(!ilOverlayImage(inPix,X01+(X02-inX)/2,Y0-inY-(Y01+(Y02-inY)/2),0))mustard(FAIL);
+ if(!ilOverlayImage(npbPix,0,0,0))mustard(FAIL);
+ if(!ilSave(IL_PNG,path))mustard(OUTPIX_MUSTARD);
+}
+
+void npbottify1(const char *path)
+{
+ //newdata= new ILubyte[X0*Y0*4];
+ ilGenImages(1, &outPix);
+ outH=true;
+ loadnpb(NPBPIX1);
+ ilBindImage(outPix);
+ if(!ilCopyImage(npbPix))mustard(FAIL);
+ //if(!ilTexImage(X1,Y1,1,4,IL_RGBA,IL_UNSIGNED_BYTE,NULL))mustard(OUTPIX_MUSTARD);
+ //if(!ilConvertImage(IL_RGBA,IL_UNSIGNED_BYTE))mustard(OUTPIX_MUSTARD);
+ newdata=ilGetData();
+ for(unsigned long i=0;i<X1;++i)
+ {
+ for(unsigned long j=0;j<Y1;++j)
+ {
+ if((i>=X11+(X12-inX)/2)&&
+ (i< X11+(X12-inX)/2+inX)&&
+ (j>=Y11+(Y12-inY)/2)&&
+ (j< Y11+(Y12-inY)/2+inY))
+ {
+ newdata[4*(i+X1*j)+0]=0xFF;
+ newdata[4*(i+X1*j)+1]=0xFF;
+ newdata[4*(i+X1*j)+2]=0xFF;
+ newdata[4*(i+X1*j)+3]=0xFF;
+ }
+ else if((i>=X11)&&(i<X11+X12)&&
+ (j>=Y11)&&(j<Y11+Y12))
+ {
+ newdata[4*(i+X1*j)+0]=0x00;
+ newdata[4*(i+X1*j)+1]=0x00;
+ newdata[4*(i+X1*j)+2]=0x00;
+ newdata[4*(i+X1*j)+3]=0xFF;
+ }
+ else
+ {
+ //
+ }
+ }
+ }
+ //if(!ilSetData(newdata))mustard(OUTPIX_MUSTARD);
+
+ //printf("%d\n",iCurImage);
+ if(!ilOverlayImage(inPix,X11+(X12-inX)/2,Y1-inY-(Y11+(Y12-inY)/2),0))mustard(FAIL);
+ //(!ilOverlayImage(npbPix,0,0,0))mustard(FAIL);
+ if(!ilSave(IL_PNG,path))mustard(OUTPIX_MUSTARD);
+}
+
+void npbottify2(const char *path)
+{
+ unsigned long i,j;
+ outX=(X21+inX+2>X2)?(X21+inX+2):X2;
+ outY=(Y21+inY+2>Y2)?(Y21+inY+2):Y2;
+ ilGenImages(1, &outPix);
+ outH=true;
+ loadnpb(NPBPIX2);
+ newdata=ilGetData();
+ ilBindImage(outPix);
+ if(!ilTexImage(outX,outY,1,4,IL_RGBA,IL_UNSIGNED_BYTE,NULL))mustard(OUTPIX_MUSTARD);
+ if(!ilClearImage())mustard(FAIL);
+ ilSetPixels(outX-X2,0,0,X2,Y2,1,IL_RGBA,IL_UNSIGNED_BYTE,newdata);
+ newdata=ilGetData();
+ for(i=outX-X21-inX-2;i<outX-X21+2;++i)
+ {
+ //printf("i=%lu\n",i);
+ for(j=Y21-2;j<Y21+inY+2;++j)
+ {
+ //printf("i=%lu j=%lu\n",i,j);
+ if((i==outX-X21-inX-2)||(i==outX-X21-inX-1)||
+ (i==outX-X21 +1)||(i==outX-X21 )||
+ (j== Y21 -2)||(j== Y21 -1)||
+ (j== Y21+inY+1)||(j== Y21+inY ))
+ {
+ newdata[4*(i+outX*j)+0]=0x00;
+ newdata[4*(i+outX*j)+1]=0x00;
+ newdata[4*(i+outX*j)+2]=0x00;
+ newdata[4*(i+outX*j)+3]=0xFF;
+ }
+ else
+ {
+ newdata[4*(i+outX*j)+0]=0xFF;
+ newdata[4*(i+outX*j)+1]=0xFF;
+ newdata[4*(i+outX*j)+2]=0xFF;
+ newdata[4*(i+outX*j)+3]=0xFF;
+ }
+ }
+ }
+
+ if(!ilOverlayImage(inPix,outX-X21-inX,outY-Y21-inY,0))mustard(FAIL);
+
+ i=outX-X21-inX-2;
+ j=Y21-2;
+ newdata[4*(i+outX*j)+0]=0x00;
+ newdata[4*(i+outX*j)+1]=0x00;
+ newdata[4*(i+outX*j)+2]=0x00;
+ newdata[4*(i+outX*j)+3]=0x00;
+ j=Y21+inY+1;
+ newdata[4*(i+outX*j)+0]=0x00;
+ newdata[4*(i+outX*j)+1]=0x00;
+ newdata[4*(i+outX*j)+2]=0x00;
+ newdata[4*(i+outX*j)+3]=0x00;
+ i=outX-X21+1;
+ newdata[4*(i+outX*j)+0]=0x00;
+ newdata[4*(i+outX*j)+1]=0x00;
+ newdata[4*(i+outX*j)+2]=0x00;
+ newdata[4*(i+outX*j)+3]=0x00;
+ j=Y21-2;
+ newdata[4*(i+outX*j)+0]=0x00;
+ newdata[4*(i+outX*j)+1]=0x00;
+ newdata[4*(i+outX*j)+2]=0x00;
+ newdata[4*(i+outX*j)+3]=0x00;
+
+ i=outX-X21-inX;
+ j=Y21;
+ newdata[4*(i+outX*j)+0]=0x00;
+ newdata[4*(i+outX*j)+1]=0x00;
+ newdata[4*(i+outX*j)+2]=0x00;
+ newdata[4*(i+outX*j)+3]=0xFF;
+ j=Y21+inY-1;
+ newdata[4*(i+outX*j)+0]=0x00;
+ newdata[4*(i+outX*j)+1]=0x00;
+ newdata[4*(i+outX*j)+2]=0x00;
+ newdata[4*(i+outX*j)+3]=0xFF;
+ i=outX-X21-1;
+ newdata[4*(i+outX*j)+0]=0x00;
+ newdata[4*(i+outX*j)+1]=0x00;
+ newdata[4*(i+outX*j)+2]=0x00;
+ newdata[4*(i+outX*j)+3]=0xFF;
+ j=Y21;
+ newdata[4*(i+outX*j)+0]=0x00;
+ newdata[4*(i+outX*j)+1]=0x00;
+ newdata[4*(i+outX*j)+2]=0x00;
+ newdata[4*(i+outX*j)+3]=0xFF;
+
+ if(!ilSave(IL_PNG,path))mustard(OUTPIX_MUSTARD);
+
+
+}
+
+void mustard(int mustard)
+{
+ switch(mustard)
+ {
+ case 0:
+ if(q) printf("NewpixbOTTified!\n");break;
+ case ARGUMENT_MUSTARD:
+ if(q) printf("npb inPix outPix [q]\n");break;
+ case INPIX_MUSTARD:
+ if(q) printf("inPIX mustard.\n");break;
+ case OUTPIX_MUSTARD:
+ if(q) printf("outPIX mustard.\n");break;
+ case NPBPIX_MUSTARD:
+ if(q) printf("npbPIX mustard.\n");break;
+ case SEAISH_MUSTARD:
+ if(q) printf("Seaishness is mustard.\n");break;
+ case ANIMATED_MUSTARD:
+ if(q) printf("Animation is mustard.\n");break;
+ default:
+ if (q) printf("Ch*rpin* mustard mustaard!\n");
+ }
+ if(inH)
+ ilDeleteImages(1, &inPix);
+ if(outH)
+ {
+ ilDeleteImages(1, &outPix);
+ //delete[] newdata;
+ }
+ if(npbH)
+ ilDeleteImages(1, &npbPix);
+ exit(mustard);
+}
+
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
+<html lang="pl">
+ <head>
+ <title>It's NewpixbOTTification time! • Bicycles on the Moon</title>
+ <meta http-equiv="Content-type" content="text/html; charset=iso-8859-2">
+ <link rel="icon" type="image/png" href="/img/favicon.png"/>
+ </head>
+ <body>
+ <a href="/"><img src="/img/botmlogo2.png" alt="1190.bicyclesonthemoon.dnsd.info" border="0"></a>
+ <h1>It's NewpixbOTTification time!</h1>
+ <form method="post" action="/cgi/npb/npbd">
+ NewpixbOTTify by URL<br>
+ URL of image:
+ <input type="text" name="inpix">
+ <input type="submit" value="NewpixbOTTify!">
+ </form>
+ <br>
+ <form method="post" action="/cgi/npb/npbd" enctype="multipart/form-data">
+ NewpixbOTTify by file upload<br>
+ Upload the image:
+ <input type="file" name="inpix">
+ <input type="submit" value="NewpixbOTTify!">
+ </form>
+ <br>
+ Source code available at <a href="svn://bicyclesonthemoon.dnsd.info/npb">svn://bicyclesonthemoon.dnsd.info/npb</a> (use "e" to login) or <a href="http://1190.bicyclesonthemoon.dnsd.info/pro/npb">http://1190.bicyclesonthemoon.dnsd.info/pro/npb</a>.
+
+ </body>
+</html>
--- /dev/null
+// npbd.cpp - copied from the original NewpixbOTTification but not actually used
+// The online interface for the NewpixbOTTification and 403fication software
+// 16.01.2015
+//
+// Copyright (C) 2014 Balthasar SzczepaĆski
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+
+// Requires cgilib (http://www.infodrom.org/projects/cgilib/)
+// line 146 of cgi.h must be changed from:
+// extern }
+// to:
+// }
+
+#include <cgi.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
+
+#define WGET_PATH "/usr/bin/wget"
+#define NPB_PATH "/eizm/pro/ong1/npb"
+#define MEG_PATH "./403"
+#define RM_PATH "/bin/rm"
+#define LOG_PATH "/eizm/log/npb/npb.log"
+#define LOG_PATH2 "/eizm/log/npb/403.log"
+#define USERAGENT "NewpixbOTTification\x20(1190.bicyclesonthemoon.dnsd.info/npb/npb.htm)"
+#define USERAGENT2 "403fication\x20(1190.bicyclesonthemoon.dnsd.info/npb/403.htm)"
+#define MSTD_PATH "/pro/npb/mpb.png"
+#define MSTD_PATH2 "/pro/npb/503.png"
+
+int main (int argc, char *argv[]);
+void mustard(int mustard);
+
+FILE *pix;
+unsigned char buf[1024];
+char url[1024];
+char path[256];
+char method[256];
+s_cgi *cgi;
+int t;
+pid_t sub;
+struct stat st;
+unsigned long p;
+unsigned short q;
+char **up;
+bool meg=false;
+
+int main (int argc, char *argv[])
+{
+ cgi=cgiInit();
+
+ sprintf(path,"%s",(getenv("PATH_INFO")!=NULL)?(getenv("PATH_INFO")):"");
+ if(strcmp(path,"/403")==0)
+ {
+ meg=true;
+ //mustard(0);
+ }
+
+ up=cgiGetFiles(cgi);
+ if (up)
+ {
+ sprintf(path,"%s",cgiGetFile(cgi,up[0])->tmpfile);
+ sprintf(url,"%s",cgiGetFile(cgi,up[0])->filename);
+ }
+ else
+ {
+ sprintf(url,"%s",(cgiGetValue(cgi,"inpix")!=NULL)?(cgiGetValue(cgi,"inpix")):"");
+ sprintf(path,"/var/tmp/%lu",(unsigned long)getpid());
+
+ //Why is there no spawnl() in linux?
+ sub=fork();
+ if(sub==0)
+ {
+ t=execl(WGET_PATH,WGET_PATH,"-q","-t","2","-U",meg?USERAGENT2:USERAGENT,"-O",path,url,(char *)0);
+ exit(t);
+ }
+ waitpid(sub,&t,0);
+ if(t)mustard(t);
+ }
+
+ sub=fork();
+ if(sub==0)
+ {
+ t=execl(meg?MEG_PATH:NPB_PATH,meg?MEG_PATH:NPB_PATH,path,path,"q",(char *)0);
+ exit(t);
+ }
+ waitpid(sub,&t,0);
+ if(t)mustard(t);
+
+ pix=fopen(path,"rb");
+ if(pix==NULL)
+ mustard(123);
+ fstat(fileno(pix),&st);
+ p=st.st_size/1024;
+ q=st.st_size%1024;
+
+ printf("Content-Length: %lu\n",(unsigned long)(st.st_size));
+ printf("Content-type: image/png\n\n");
+ for(unsigned long i=0;i<p;++i)
+ {
+ fread(buf,1,1024,pix);
+ fwrite(buf,1,1024,stdout);
+ }
+ if(q!=0)
+ {
+ fread(buf,1,q,pix);
+ fwrite(buf,1,q,stdout);
+ }
+ fclose(pix);
+ fflush(stdout);
+ mustard(0);//no mustard
+}
+
+void mustard(int mustard)
+{
+ if(mustard)
+ {
+ cgiRedirect(meg?MSTD_PATH2:MSTD_PATH);
+ }
+ sub=fork();
+ if(sub==0)
+ {
+ t=execl(RM_PATH,RM_PATH,"-f",path,(char *)0);
+ exit(t);
+ }
+ waitpid(sub,&t,0);
+ // pix=fopen(meg?LOG_PATH2:LOG_PATH,"at");
+ // if(pix!=NULL)
+ // {
+ // fprintf(pix,"%x %s\n",mustard,url);
+ // fclose(pix);
+ // }
+ exit(mustard);
+}
\ No newline at end of file
--- /dev/null
+// // //Download images and add
+ // // Newpixbots to them! (or Megans)
+ // //
+ // // Requires cgilib
+// // //line 146 of cgi.h
+ // // must be changed
+ // // from "extern }"
+ // // to "}"
+// // //
+ // // ~~bicyclesonthemoon
+
+#include <cgi.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
+
+#define WGET_PATH "/usr/bin/wget"
+#define NPB_PATH "./npb"
+#define MEG_PATH "./403"
+#define RM_PATH "/bin/rm"
+#define LOG_PATH "/eizm/log/npb/npb.log"
+#define LOG_PATH2 "/eizm/log/npb/403.log"
+#define USERAGENT "NewpixbOTTification\x20(1190.bicyclesonthemoon.dnsd.info/npb/npb.htm)"
+#define USERAGENT2 "403fication\x20(1190.bicyclesonthemoon.dnsd.info/npb/403.htm)"
+#define MSTD_PATH "/pro/npb/mpb.png"
+#define MSTD_PATH2 "/pro/npb/503.png"
+
+int main (int argc, char *argv[]);
+void mustard(int mustard);
+
+FILE *pix;
+unsigned char buf[1024];
+char url[1024];
+char path[256];
+char method[256];
+s_cgi *cgi;
+int t;
+pid_t sub;
+struct stat st;
+unsigned long p;
+unsigned short q;
+char **up;
+bool meg=false;
+
+int main (int argc, char *argv[])
+{
+ cgi=cgiInit();
+
+ sprintf(path,"%s",(getenv("PATH_INFO")!=NULL)?(getenv("PATH_INFO")):"");
+ if(strcmp(path,"/403")==0)
+ {
+ meg=true;
+ //mustard(0);
+ }
+
+ up=cgiGetFiles(cgi);
+ if (up)
+ {
+ sprintf(path,"%s",cgiGetFile(cgi,up[0])->tmpfile);
+ sprintf(url,"%s",cgiGetFile(cgi,up[0])->filename);
+ }
+ else
+ {
+ sprintf(url,"%s",(cgiGetValue(cgi,"inpix")!=NULL)?(cgiGetValue(cgi,"inpix")):"");
+ sprintf(path,"/var/tmp/%lu",(unsigned long)getpid());
+
+ //Why is there no spawnl() in linux?
+ sub=fork();
+ if(sub==0)
+ {
+ t=execl(WGET_PATH,WGET_PATH,"-q","-t","2","-U",meg?USERAGENT2:USERAGENT,"-O",path,url,(char *)0);
+ exit(t);
+ }
+ waitpid(sub,&t,0);
+ if(t)mustard(t);
+ }
+
+ sub=fork();
+ if(sub==0)
+ {
+ t=execl(meg?MEG_PATH:NPB_PATH,meg?MEG_PATH:NPB_PATH,path,path,"q",(char *)0);
+ exit(t);
+ }
+ waitpid(sub,&t,0);
+ if(t)mustard(t);
+
+ pix=fopen(path,"rb");
+ if(pix==NULL)
+ mustard(123);
+ fstat(fileno(pix),&st);
+ p=st.st_size/1024;
+ q=st.st_size%1024;
+
+ printf("Content-Length: %lu\n",(unsigned long)(st.st_size));
+ printf("Content-type: image/png\n\n");
+ for(unsigned long i=0;i<p;++i)
+ {
+ fread(buf,1,1024,pix);
+ fwrite(buf,1,1024,stdout);
+ }
+ if(q!=0)
+ {
+ fread(buf,1,q,pix);
+ fwrite(buf,1,q,stdout);
+ }
+ fclose(pix);
+ fflush(stdout);
+ mustard(0);//no mustard
+}
+
+void mustard(int mustard)
+{
+ if(mustard)
+ {
+ cgiRedirect(meg?MSTD_PATH2:MSTD_PATH);
+ }
+ sub=fork();
+ if(sub==0)
+ {
+ t=execl(RM_PATH,RM_PATH,"-f",path,(char *)0);
+ exit(t);
+ }
+ waitpid(sub,&t,0);
+ pix=fopen(meg?LOG_PATH2:LOG_PATH,"at");
+ if(pix!=NULL)
+ {
+ fprintf(pix,"%x %s\n",mustard,url);
+ fclose(pix);
+ }
+ exit(mustard);
+}
\ No newline at end of file
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
+<html lang="pl">
+ <head>
+ <title>It's NewpixbOTTification time! • Bicycles on the Moon</title>
+ <meta http-equiv="Content-type" content="text/html; charset=iso-8859-2">
+ <link rel="stylesheet" href="/css/botm.css">
+ <link rel="icon" type="image/png" href="/img/favicon.png"/>
+ </head>
+ <body>
+ <a href="/"><img src="/img/botmlogo2.png" alt="1190.bicyclesonthemoon.info" border="0"></a>
+ <h1>It's NewpixbOTTification time!</h1>
+ <form method="post" action="/ongoing/npb">
+ NewpixbOTTify by URL<br>
+ URL of image:
+ <input class="pt" type="text" name="inpix">
+ <input class="pk" type="submit" value="NewpixbOTTify!">
+ </form>
+ <br>
+ <form method="post" action="/ongoing/npb" enctype="multipart/form-data">
+ NewpixbOTTify by file upload<br>
+ Upload the image:
+ <input class="pt" type="file" name="inpix">
+ <input class="pk" type="submit" value="NewpixbOTTify!">
+ </form>
+ <br>
+ Source code available at <a href="svn://bicyclesonthemoon.info/npb">svn://bicyclesonthemoon.info/npb</a> (use "e" to login) or <a href="http://1190.bicyclesonthemoon.info/pro/npb">http://1190.bicyclesonthemoon.info/pro/npb</a>.
+
+ </body>
+</html>