ScriptAlias /enhance/bluenh ###CONF_bluenh;
ScriptAlias /enhance/nofading ###CONF_nofading;
+ScriptAlias /enhance/reveal ###CONF_reveal;
<Directory ###CONF_bin;>
Require all granted
npb_ong1.h\
npb_403.h\
nh.h\
-nf.h
+nf.h\
+rvl.h
CGI=\
bluenh-cgi\
-nofading-cgi
+nofading-cgi\
+reveal-cgi
HTM_CGI=\
bluenh.htm\
-nofading.htm
+nofading.htm\
+reveal.htm
HTM_CGI_1=\
bluenh.1.htm\
nofading.1.htm\
-
+reveal.1.htm
# keep these 2 lists in the same order!:
GENERATE_FROM=\
param.png
#all: 403 npb npbd npb-ong1 npbd-ong1 bluenh bluenhd insert extract seediff insertframe mremapt-1 compare nofading nofadingd
-all: $(BIN) $(WWW)
+all: $(BIN) $(WWW) enhance.conf
makefile: makefile.1.mak $(CONFIGFILE)
npb_ong1.h\
npb_403.h\
nh.h\
-nf.h
+nf.h\
+rvl.h
CGI=\
bluenh-cgi\
-nofading-cgi
+nofading-cgi\
+reveal-cgi
HTM_CGI=\
bluenh.htm\
-nofading.htm
+nofading.htm\
+reveal.htm
HTM_CGI_1=\
bluenh.1.htm\
nofading.1.htm\
-
+reveal.1.htm
# keep these 2 lists in the same order!:
GENERATE_FROM=\
param.png
#all: 403 npb npbd npb-ong1 npbd-ong1 bluenh bluenhd insert extract seediff insertframe mremapt-1 compare nofading nofadingd
-all: $(BIN) $(WWW)
+all: $(BIN) $(WWW) enhance.conf
makefile: makefile.1.mak $(CONFIGFILE)
waitpid(sub, &r, 0);
return r;
}
-
-/*
-
-
-#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 "./nofading"
-#define RM_PATH "/bin/rm"
-#define LOG_PATH "/eizm/log/nofading/nofading.log"
-#define USERAGENT "No fading (1190.bicyclesonthemoon.dnsd.info/nofading/nofading.htm)"
-#define MSTD_PATH "/pro/nofading/nf.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;
-
- 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);
- }
-
- sub=fork();
- if(sub==0)
- {
- t=execl(ENH_PATH,ENH_PATH,path,path,(cgiGetValue(cgi,"f")!=NULL)?(cgiGetValue(cgi,"f")):"0","q",cgiGetValue(cgi,"a")!=NULL?"0":"a",(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
// ###C_BLUENH_PATH: #define NPB_PATH "/botm/bin/bluenh"
// ###C_NOFADING_PATH: #define NOFADING_PATH "/botm/bin/nofading"
// ###C_NPB_PATH: #define NPB_PATH "/botm/bin/npb"
+// ###C_REVEAL_PATH: #define REVEAL_PATH "/botm/bin/reveal"
int cp (char *src, char *dst);
int wget (char *url, char *dst);
--- /dev/null
+/*
+reveal-cgi.c
+The online interface for the hidden detail revealer tool
+04.12.2022
+
+Copyright (C) 2022 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/)
+*/
+
+#include <stdio.h>
+#include <stdint.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/wait.h>
+//#include <stdint.h>
+//#include <inttypes.h>
+
+#include <cgi.h>
+
+#include "online-core.h"
+#include "rvl.h"
+
+int reveal (char *inpix, char *outpix);
+
+int main (int argc, char *argv[])
+{
+ s_cgi *cgi;
+ char in_tmp[256];
+ char out_tmp[256];
+ char *in_path;
+
+ int r=0;
+ int r1=0;
+ int r2=0;
+ int r3=0;
+
+ do {
+ make_tmp_path(in_tmp, 256, 0, "");
+ make_tmp_path(out_tmp, 256, 1, ".png");
+
+ cgi=cgiInit();
+
+ r = get_file(cgi,"inpix", in_tmp, &in_path);
+ if (r)
+ break;
+
+ r = reveal(in_path, out_tmp);
+ if (r)
+ break;
+ r1 = send_file(out_tmp, "image/png", 0);
+ } while (0);
+ if (r)
+ {
+ r1 = send_data(rvl, rvl_size, "image/png", 500);
+ }
+ r2 = rm(in_tmp);
+ r3 = rm(out_tmp);
+ if (r)
+ return r;
+ if (r1)
+ return r1;
+ if (r2)
+ return r2;
+ if (r3)
+ return r3;
+ return 0;
+}
+
+int reveal (char *inpix, char *outpix)
+{
+ pid_t sub;
+ int r;
+
+ sub = fork();
+ if (sub == 0)
+ {
+ r = execl(REVEAL_PATH, REVEAL_PATH, inpix, outpix, (char *)0);
+ exit(r);
+ }
+ waitpid(sub, &r, 0);
+ return r;
+}
--- /dev/null
+ <h1>Reveal hidden detail!</h1>
+ <form method="post" action="/enhance/reveal">
+ Enhance by URL<br>
+ URL of image:
+ <input class="pt" type="text" name="inpix">
+ <input class="pk" type="submit" value="ENHANCE!"><br>
+ </form>
+ <br>
+ <form method="post" action="/enhance/reveal" enctype="multipart/form-data">
+ Enhance by file upload<br>
+ Upload the image:
+ <input class="pt" type="file" name="inpix">
+ <input class="pk" type="submit" value="ENHANCE!"><br>
+ </form>
useragent: ENHANCE!ment tool (http://1190.bicyclesonthemoon.info/enhance)
+title_bluenh: ENHANCE!
title_enhance: ENHANCE!
title_nofading: No fading!
-title_bluenh: ENHANCE!
+title_reveal: Reveal hidden detail!
bin_path: /botm/bin/enhance
conf_path: /botm/etc/www/conf/1190
_bin_nofading_cgi_path = @_PATH($bin_path, nofading-cgi)
_bin_npb_path = @_PATH($bin_path, npb)
_bin_npb_cgi_path = @_PATH($bin_path, npb-cgi)
+_bin_reveal_path = @_PATH($bin_path, reveal)
+_bin_reveal_cgi_path = @_PATH($bin_path, reveal-cgi)
_conf_path = @_PATH($conf_path, $name\.conf)
CONF_bin = $bin_path
CONF_bluenh = $_bin_bluenh_cgi_path
CONF_nofading = $_bin_nofading_cgi_path
+CONF_reveal = $_bin_reveal_cgi_path
MAKE_CONFIGURE = CONFIGURE = $configure
C_BLUENH_PATH = @_C_DEFINE_STR(BLUENH_PATH, $_bin_bluenh_path)
C_NOFADING_PATH = @_C_DEFINE_STR(NOFADING_PATH, $_bin_nofading_path)
C_NPB_PATH = @_C_DEFINE_STR(NPB_PATH, $_bin_npb_path)
+C_REVEAL_PATH = @_C_DEFINE_STR(REVEAL_PATH, $_bin_reveal_path)