1 // // //Download images and add
2 // // Newpixbots to them! (or Megans)
5 // // //line 146 of cgi.h
10 // // ~~bicyclesonthemoon
20 #define WGET_PATH "/usr/bin/wget"
21 #define NPB_PATH "./npb"
22 #define MEG_PATH "./403"
23 #define RM_PATH "/bin/rm"
24 #define LOG_PATH "/eizm/log/npb/npb.log"
25 #define LOG_PATH2 "/eizm/log/npb/403.log"
26 #define USERAGENT "NewpixbOTTification\x20(1190.bicyclesonthemoon.dnsd.info/npb/npb.htm)"
27 #define USERAGENT2 "403fication\x20(1190.bicyclesonthemoon.dnsd.info/npb/403.htm)"
28 #define MSTD_PATH "/pro/npb/mpb.png"
29 #define MSTD_PATH2 "/pro/npb/503.png"
31 int main (int argc, char *argv[]);
32 void mustard(int mustard);
35 unsigned char buf[1024];
48 int main (int argc, char *argv[])
52 sprintf(path,"%s",(getenv("PATH_INFO")!=NULL)?(getenv("PATH_INFO")):"");
53 if(strcmp(path,"/403")==0)
62 sprintf(path,"%s",cgiGetFile(cgi,up[0])->tmpfile);
63 sprintf(url,"%s",cgiGetFile(cgi,up[0])->filename);
67 sprintf(url,"%s",(cgiGetValue(cgi,"inpix")!=NULL)?(cgiGetValue(cgi,"inpix")):"");
68 sprintf(path,"/var/tmp/%lu",(unsigned long)getpid());
70 //Why is there no spawnl() in linux?
74 t=execl(WGET_PATH,WGET_PATH,"-q","-t","2","-U",meg?USERAGENT2:USERAGENT,"-O",path,url,(char *)0);
84 t=execl(meg?MEG_PATH:NPB_PATH,meg?MEG_PATH:NPB_PATH,path,path,"q",(char *)0);
93 fstat(fileno(pix),&st);
97 printf("Content-Length: %lu\n",(unsigned long)(st.st_size));
98 printf("Content-type: image/png\n\n");
99 for(unsigned long i=0;i<p;++i)
101 fread(buf,1,1024,pix);
102 fwrite(buf,1,1024,stdout);
107 fwrite(buf,1,q,stdout);
111 mustard(0);//no mustard
114 void mustard(int mustard)
118 cgiRedirect(meg?MSTD_PATH2:MSTD_PATH);
123 t=execl(RM_PATH,RM_PATH,"-f",path,(char *)0);
127 pix=fopen(meg?LOG_PATH2:LOG_PATH,"at");
130 fprintf(pix,"%x %s\n",mustard,url);