Modificata data section per allinearla a 4. Pulito server.cpp e decrypt.pstc
This commit is contained in:
parent
a0128d323b
commit
394cd5d9c6
@ -104,8 +104,4 @@ poop s0
|
||||
addi s0, 4
|
||||
cmpr s0, r2
|
||||
jpbi decrypt
|
||||
lodi r0, 0
|
||||
lodi r1, 2
|
||||
lodi r2, 4
|
||||
lodi r3, 6
|
||||
shit
|
@ -1 +1 @@
|
||||
TheDataSectionHasBeenEncrypted!WhoAreYouGonnaCall?TheRuNasss!
|
||||
TheDataSectionHasBeenEncrypted...WhoAreYouGonnaCall...TheRuNasOfCourse..
|
@ -1 +1 @@
|
||||
Œê¾ªí Ðk™R%¹æØÿùé’zÅÄ~*ìg2E$ÐLdYí¦xþѼàØ:ùûùùn\RXF<58>UXE!
|
||||
ŚęľŞí Đk™R%ąćŘ˙ůé’zĹÄ~*ěg2†Ę˙ř<wBă )K4gKÉź©ů›Š[rdĺŘ\RXFď6v‡ěű]BŽ·G
|
@ -1,5 +1,5 @@
|
||||
#include "../../vm/vm.h"
|
||||
#include "../../vm/debug.h"
|
||||
#include "../../vm/vm.h"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <stdint.h>
|
||||
@ -8,9 +8,19 @@
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define KEYLEN 15
|
||||
#define OPCODES_KEYLEN 15
|
||||
#define CODESIZE 0x300
|
||||
#define DATAKEYLEN 30
|
||||
#define FLAG_LEN 30
|
||||
|
||||
unsigned char EN_DATASECTION[] = {
|
||||
0x8c, 0xea, 0xbe, 0xaa, 0xed, 0xa0, 0xd0, 0x6b, 0x99, 0x1c, 0x52, 0x25,
|
||||
0xb9, 0xe6, 0xd8, 0xff, 0xf9, 0xe9, 0x92, 0x7a, 0x1c, 0xc5, 0xc4, 0x7e,
|
||||
0x2a, 0xec, 0x67, 0x32, 0x86, 0xca, 0xff, 0xf8, 0x3c, 0x1c, 0x77, 0x42,
|
||||
0xe3, 0x20, 0x29, 0x4b, 0x34, 0x67, 0x4b, 0xc9, 0x9f, 0xa9, 0xf9, 0x0c,
|
||||
0x0f, 0x9b, 0x8a, 0x5b, 0x72, 0x64, 0xe5, 0xd8, 0x5c, 0x52, 0x58, 0x46,
|
||||
0xef, 0x36, 0x76, 0x87, 0xec, 0x1e, 0xfb, 0x5d, 0x42, 0x8e, 0xb7, 0x47};
|
||||
|
||||
unsigned int DATASECTIONLEN = 72;
|
||||
|
||||
void gen_random(uint8_t *s, const int len) {
|
||||
srand(time(NULL));
|
||||
@ -24,28 +34,17 @@ void gen_random(uint8_t *s, const int len) {
|
||||
s[len] = 0;
|
||||
}
|
||||
|
||||
unsigned char encrypted_data[] = {
|
||||
0x8c, 0xea, 0xbe, 0xaa, 0xed, 0xa0, 0xd0, 0x6b, 0x99, 0x1c, 0x52, 0x25,
|
||||
0xb9, 0xe6, 0xd8, 0xff, 0xf9, 0xe9, 0x92, 0x7a, 0x1c, 0xc5, 0xc4, 0x7e,
|
||||
0x2a, 0xec, 0x67, 0x32, 0x1f, 0x45, 0x24, 0xd0, 0x4c, 0x7f, 0x15, 0x64,
|
||||
0x59, 0xed, 0xa6, 0x78, 0xfe, 0xad, 0xd1, 0xbc, 0xe0, 0xd8, 0x3a, 0xf9,
|
||||
0xfb, 0xf9, 0xf9, 0x6e, 0x5c, 0x52, 0x58, 0x46, 0x8d, 0x55, 0x58, 0x45,
|
||||
0x21
|
||||
};
|
||||
unsigned int encrypted_data_len = 61;
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
uint8_t *key = new uint8_t[KEYLEN], *decdatasec = new uint8_t[encrypted_data_len],
|
||||
*flag = new uint8_t[DATAKEYLEN];
|
||||
uint8_t *opcodes_key = new uint8_t[OPCODES_KEYLEN],
|
||||
*decdatasec = new uint8_t[DATASECTIONLEN],
|
||||
*flag = new uint8_t[FLAG_LEN];
|
||||
uint8_t *clientcode;
|
||||
uint8_t i;
|
||||
uint32_t clientcodesize, bytesread;
|
||||
FILE *datap, *flagp;
|
||||
|
||||
gen_random(key, KEYLEN);
|
||||
printf("Use this: \"%s\"\n", key);
|
||||
fflush(stdout);
|
||||
gen_random(opcodes_key, OPCODES_KEYLEN);
|
||||
printf("Use this: \"%s\"\n", opcodes_key);
|
||||
printf("How much data are you sending me?\n");
|
||||
fflush(stdout);
|
||||
scanf("%d", &clientcodesize);
|
||||
@ -58,12 +57,8 @@ int main(int argc, char *argv[]) {
|
||||
fflush(stdout);
|
||||
exit(1);
|
||||
}
|
||||
VM vm(key, clientcode, clientcodesize);
|
||||
vm.as.insData(encrypted_data, encrypted_data_len);
|
||||
printf("BEFORE:\n");
|
||||
for (i = 0; i < DATAKEYLEN; i++) {
|
||||
fprintf(stdout, "buf[%d] = 0x%02x\n", i, vm.as.data[i]);
|
||||
}
|
||||
VM vm(opcodes_key, clientcode, clientcodesize);
|
||||
vm.as.insData(EN_DATASECTION, DATASECTIONLEN);
|
||||
vm.run();
|
||||
|
||||
datap = fopen("../res/decrypteddatasection.txt", "r");
|
||||
@ -75,13 +70,9 @@ int main(int argc, char *argv[]) {
|
||||
fscanf(datap, "%s", decdatasec);
|
||||
fclose(datap);
|
||||
|
||||
for (i = 0; i < DATAKEYLEN; i++) {
|
||||
fprintf(stdout, "buf[%d] = 0x%02x\n", i, vm.as.data[i]);
|
||||
}
|
||||
for (i = 0; i < DATAKEYLEN; i++) {
|
||||
for (i = 0; i < DATASECTIONLEN; i++) {
|
||||
DBG_INFO(("Checking data[%d]..\n", i));
|
||||
if (vm.as.data[i] != decdatasec[i]) {
|
||||
printf("Checking data[%d]..\n", i);
|
||||
fflush(stdout);
|
||||
printf("Nope!\n");
|
||||
fflush(stdout);
|
||||
exit(1);
|
||||
|
Loading…
Reference in New Issue
Block a user