]> bicyclesonthemoon.info Git - ott/enhance/commitdiff
reveal online
authorb <rowerynaksiezycu@gmail.com>
Sun, 4 Dec 2022 22:35:07 +0000 (22:35 +0000)
committerb <rowerynaksiezycu@gmail.com>
Sun, 4 Dec 2022 22:35:07 +0000 (22:35 +0000)
enhance.1.conf
makefile
makefile.1.mak
nofading-cgi.c
online-core.1.h
reveal-cgi.c [new file with mode: 0644]
reveal.1.htm [new file with mode: 0644]
rvl.png [new file with mode: 0644]
settings-release.txt
settings.txt

index 47f21d214cb8a33b1f2279a96bb69050fcb2243d..8dbf99f0907c075738a0d2e28708cbfbe3700151 100644 (file)
@@ -2,6 +2,7 @@
 
 ScriptAlias /enhance/bluenh   ###CONF_bluenh;
 ScriptAlias /enhance/nofading ###CONF_nofading;
+ScriptAlias /enhance/reveal   ###CONF_reveal;
 
 <Directory ###CONF_bin;>
        Require all granted
index 9998d0dc42fb34c2940e46bbc5e105a58a094bb2..1af611e65c96bef24254151ab41d758e024aa14d 100644 (file)
--- a/makefile
+++ b/makefile
@@ -106,20 +106,23 @@ npb2.h\
 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=\
@@ -149,7 +152,7 @@ $(HTM_CGI)\
 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)
index b54178cb43eca2f1c376392168faad7e744af803..58ce7abfb907da6cef5b7bf2c972c119847a66a4 100644 (file)
@@ -106,20 +106,23 @@ npb2.h\
 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=\
@@ -149,7 +152,7 @@ $(HTM_CGI)\
 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)
index 5b4f065562aa98b2bb895db2527fa040e92d6305..1c3c410452bc4923ad690d8c6f1278768ca0ec9f 100644 (file)
@@ -134,121 +134,3 @@ int nofading (
        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
index 71fecfcd156048849c96ee79024444e5c330e55e..6b8f87051a1922ebb2e62d63e23c3e085f53d2e1 100644 (file)
@@ -35,6 +35,7 @@ Requires cgilib (http://www.infodrom.org/projects/cgilib/)
 // ###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);
diff --git a/reveal-cgi.c b/reveal-cgi.c
new file mode 100644 (file)
index 0000000..a03f077
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+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;
+}
diff --git a/reveal.1.htm b/reveal.1.htm
new file mode 100644 (file)
index 0000000..0648c1e
--- /dev/null
@@ -0,0 +1,14 @@
+               <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>
diff --git a/rvl.png b/rvl.png
new file mode 100644 (file)
index 0000000..0744b45
Binary files /dev/null and b/rvl.png differ
index 57b49c19f1599102567638a214a647e309ffd966..2350af8ae6807b1643aef3678b6611512d0b2fca 100644 (file)
@@ -13,9 +13,10 @@ configure: /botm/bin/config/configure.pl
 
 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
index 56e70fb405f8bacf759faf27fcba051b4341dc0f..202c4ec4a5afdb7dec9f3d06ece09fd790c40d42 100644 (file)
@@ -25,6 +25,8 @@ _bin_nofading_path     = @_PATH($bin_path, nofading)
 _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)
 
@@ -34,6 +36,7 @@ HTML_TITLE = @_HTML_TITLE()
 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
@@ -69,3 +72,4 @@ C_TEMP_PATH = @_C_DEFINE_STR(TEMP_PATH, $tmp_path)
 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)