-- Leo's gemini proxy

-- Connecting to git.thebackupbox.net:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

repo: misc
action: commit
revision:
path_from:
revision_from: a05876c9b860f1d5fa786746519ccb8b01db79e3:
path_to:
revision_to:

git.thebackupbox.net

misc

git://git.thebackupbox.net/misc

commit a05876c9b860f1d5fa786746519ccb8b01db79e3
Author: epochqwert <epoch@hacking.allowed.org>
Date:   Fri Jun 12 22:26:31 2015 -0500

    commit of half-finished things.

diff --git a/nocompile/bin/rss b/nocompile/bin/rss
new file mode 100755
index 0000000000000000000000000000000000000000..3a9e882c738f4a52fabce60f337775576abc4cc0
--- /dev/null
+++ b/nocompile/bin/rss
@@ -0,0 +1,2 @@
+#!/bin/sh
+wget -qO- https://news.ycombinator.com/rss
diff --git a/nocompile/bin/ssl b/nocompile/bin/ssl
new file mode 100644
index 0000000000000000000000000000000000000000..4e761224d63c9f461dfc734f519afc8f90de4773
--- /dev/null
+++ b/nocompile/bin/ssl
@@ -0,0 +1,7 @@
+#!/bin/sh
+#fix this to suit your needs.
+/usr/local/bin/ncat --ssl "$1" "$2"
+
+#I heard this was a bad idea.
+#openssl s_client -q -connect "$1:$2"
+
diff --git a/src/bin/fontdump.c b/src/bin/fontdump.c

index eb481d05395373797e812d32838083b3df952c88..

index ..1ed2b05adcc2f35e3d3c537f9ea3d3857674d1b1 100644

--- a/src/bin/fontdump.c
+++ b/src/bin/fontdump.c
@@ -10,7 +10,7 @@ int main(int argc,char *argv[]) {
   read(0,map,height);
   for(j=0;j<height;j++) {
    for(k=7;k>=0;k--) {
-    printf("%c",(map[j]>>k&1)?'#':' ');
+    printf("%c",(map[j]>>k&1)?'#':'.');
    }
    printf("\n");
   }
diff --git a/src/bin/iplist2cidr.c b/src/bin/iplist2cidr.c
new file mode 100644
index 0000000000000000000000000000000000000000..b3cc62cdd82c1f615c26d41294469f4b9699db11
--- /dev/null
+++ b/src/bin/iplist2cidr.c
@@ -0,0 +1,79 @@
+#include <stdio.h>
+#include <string.h>
+
+struct net {
+ unsigned int ip;
+ unsigned char cidr;
+};
+
+#define min(a,b) ((a)<(b)?(a):(b))
+#define max(a,b) ((a)>(b)?(a):(b))
+
+int main(int argc,char *argv[]) {
+ short in;
+ int maxcidr;
+ int i=0,j=0,len=0;
+ struct net list[65536];//don't do more than a /16!
+ char ips[64];//why not?
+ char *cidrs;
+ while((in=fgetc(stdin)) != -1) {
+  if(in=='\n') {
+   ips[i]=0;
+   if((cidrs=strchr(ips,'/')) != 0) {
+    *cidrs=0;
+    cidrs++;
+   }
+   list[len].ip=htonl(inet_addr(ips));
+   list[len].cidr=cidrs?atoi(cidrs):32;
+   i=0;
+   cidrs=0;
+   len++;
+   continue;
+  }
+  ips[i]=in;
+  i++;
+  if(i>63) {
+   printf("your have a line that is TOOO long. stick to IPv4.\n");
+   return 0;
+  }
+ }
+ //!!!warning!!! inefficient algo ahead!
+ for(i=0;i<len;i++) {
+  for(j=0;j<len;j++) {
+   if(list[i].cidr == list[j].cidr) {
+    if((list[i].ip ^ list[j].ip) >> (32-list[i].cidr) == 1) {
+     list[i].cidr--;
+     list[j].cidr--;
+     list[i].ip &= (0xffffffff << (32-list[i].cidr));
+     list[j].ip &= (0xffffffff << (32-list[j].cidr));
+     i=-1;//start over!
+     j=-1;//start over!
+     continue;
+    }
+   }
+   if(list[i].ip == list[j].ip && list[i].cidr != list[j].cidr) {
+    list[i].cidr = min(list[i].cidr,list[j].cidr);
+    list[j].cidr = min(list[i].cidr,list[j].cidr);
+    i=-1;//start over!
+    j=-1;//start over!
+    continue;
+   }
+   maxcidr=min(list[i].cidr,list[j].cidr);
+   if(list[i].cidr != list[j].cidr) {
+    if(list[i].ip >> (32-maxcidr) == list[j].ip >> (32-maxcidr) ) {
+     list[i].cidr = min(list[i].cidr,list[j].cidr);
+     list[j].cidr = min(list[i].cidr,list[j].cidr);
+     list[i].ip &= (0xffffffff << (32-list[i].cidr));
+     list[j].ip &= (0xffffffff << (32-list[j].cidr));
+     i=-1;//start over!
+     j=-1;//start over!
+     continue;
+    }
+   }
+  }
+ }
+ for(i=0;i<len;i++) {
+  printf("%d.%d.%d.%d/%d\n",list[i].ip>>24&255,list[i].ip>>16&255,list[i].ip>>8&255,list[i].ip&255,list[i].cidr);
+ }
+ return 0;
+}
diff --git a/src/bin/iprand.c b/src/bin/iprand.c
new file mode 100644
index 0000000000000000000000000000000000000000..e6b2f83cc934dcf0d81236cac86d53e75ad41aac
--- /dev/null
+++ b/src/bin/iprand.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+#include <time.h>
+
+int main(int argc,char *argv[]) {
+ srandom(time(0)+getpid());
+ unsigned int ip;
+ unsigned int net=argc>1?htonl(inet_addr(argv[1])):0x0;
+ unsigned int mask=argc>2?htonl(inet_addr(argv[2])):0x0;
+ unsigned int a=argc>3?atoi(argv[3]):3;
+ net &= mask;
+ for(;a>0;a--) {
+  ip=random();
+  ip &= ~mask;
+  ip |= net;
+  printf("%d.%d.%d.%d\n",ip>>24&255,ip>>16&255,ip>>8&255,ip&255);
+ }
+}

-----END OF PAGE-----

-- Response ended

-- Page fetched on Sun Jun 2 14:17:14 2024