summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpommicket <leonardomtenenbaum@gmail.com>2016-07-23 15:09:52 -0400
committerpommicket <leonardomtenenbaum@gmail.com>2016-07-23 15:09:52 -0400
commit3da5857996f61c31d10b65af4003c60003c0e6d7 (patch)
tree464b1572a09b514416e99441cc964f5a9150d0d8
parente0c30639e732e6baac3e3c1ed768c5d93fa4060b (diff)
Initial commit
-rwxr-xr-xJPGDestroyerbin0 -> 9952 bytes
-rwxr-xr-xJPGDestroyer.exebin0 -> 130905 bytes
-rw-r--r--Makefile9
-rw-r--r--example.jpgbin0 -> 156942 bytes
-rw-r--r--main.c68
-rw-r--r--original.jpgbin0 -> 156942 bytes
6 files changed, 77 insertions, 0 deletions
diff --git a/JPGDestroyer b/JPGDestroyer
new file mode 100755
index 0000000..d117075
--- /dev/null
+++ b/JPGDestroyer
Binary files differ
diff --git a/JPGDestroyer.exe b/JPGDestroyer.exe
new file mode 100755
index 0000000..24faa78
--- /dev/null
+++ b/JPGDestroyer.exe
Binary files differ
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..133d8cb
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,9 @@
+CC=gcc
+
+default: JPGDestroyer
+
+JPGDestroyer: main.c
+ $(CC) main.c -o JPGDestroyer
+
+clean:
+ rm JPGDestroyer
diff --git a/example.jpg b/example.jpg
new file mode 100644
index 0000000..73eca2d
--- /dev/null
+++ b/example.jpg
Binary files differ
diff --git a/main.c b/main.c
new file mode 100644
index 0000000..8cc0099
--- /dev/null
+++ b/main.c
@@ -0,0 +1,68 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#define TOO_SMALL_ERROR 1
+
+int main()
+{
+ char* filename;
+ int file_name_size;
+
+ FILE* fp;
+ int file_size;
+ int i;
+
+ int pos;
+ int amount;
+
+ char* fileContents;
+
+ srand(time(NULL));
+
+ filename = malloc(1024);
+ printf("File to destroy (it will be overwritten): ");
+
+ fgets(filename, 1024, stdin);
+ filename = strtok(filename, "\n");
+
+ file_name_size = strlen(filename);
+
+ fp = fopen(filename, "rb");
+
+ fseek(fp, 0L, SEEK_END);
+ file_size = ftell(fp);
+ fseek(fp, 0L, SEEK_SET);
+
+
+ if (file_size < 2100)
+ {
+ fprintf(stderr, "Error: File too small: %s.", filename);
+ return TOO_SMALL_ERROR;
+ }
+
+ fileContents = malloc(file_size);
+ fread(fileContents, 1, file_size, fp);
+ fclose(fp);
+
+ pos = file_size/4 + (int)(file_size/4 * ((double)rand()/RAND_MAX));
+
+ printf("Destruction amount (~50 is recommended): ");
+ scanf("%d", &amount);
+
+ for (i = pos; i < pos+amount; i++)
+ {
+ fileContents[i] = '0';
+ }
+
+ fp = fopen(filename, "wb");
+ fwrite(fileContents, 1, file_size, fp);
+
+ fclose(fp);
+ printf("Done! Your image might be corrupt.\n");
+
+
+ return 0;
+
+}
diff --git a/original.jpg b/original.jpg
new file mode 100644
index 0000000..3b42e17
--- /dev/null
+++ b/original.jpg
Binary files differ