Skip to content

Instantly share code, notes, and snippets.

View blaquee's full-sized avatar

genuine_ blaquee

View GitHub Profile
var http = require('http'),
path = require('path'),
fs = require('fs'),
util = require('util');
var extdir = '/extensions';
// create the server
http.createServer(_handleReq).listen(3000);
console.log('Server running, listening on port 3000');
@blaquee
blaquee / gist:5732931
Created June 7, 2013 22:45
GetCurrentdir Test 1
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <iterator>
int main(int argc, const char * argv[]){
std::ifstream in("testfile.txt");
std::vector<std::string> vec;
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <iterator>
#include <unistd.h>
#include <sys/param.h>
//#include <mach-o/dyld.h>
@blaquee
blaquee / gist:5732986
Created June 7, 2013 22:58
Final Test
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <iterator>
#include <unistd.h>
#include <sys/param.h>
#include <mach-o/dyld.h>
@blaquee
blaquee / gist:5733003
Created June 7, 2013 23:00
Strip Path
// strip filename from path
std::string long_path(link_path);
size_t pos = long_path.find_last_of("/\\");
std::string relative_path = long_path.substr(0,pos);
@blaquee
blaquee / gist:5746724
Created June 10, 2013 05:27
Map view of File, return base
LPVOID createMapAndGetBase(LPCTSTR filePath)
{
LPVOID fBase = 0;
__try{
hFile = CreateFile( filePath,
GENERIC_READ|GENERIC_EXECUTE,
FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL,
@blaquee
blaquee / gist:5746845
Created June 10, 2013 06:16
EndianSwap short
inline uint16_t EndianSwap16(uint16_t num)
{
return (num>>8) | (num<<8);
}
char* findtag(llist* p){
//holds address to p
llist* nextp = p;
//traverse llist p
while(1){
if(*nextp.tag == 0x41414100){
//tag matches magic tag
//not sure if necessary but lets replace address of p with nextp, holding current tag/data
p = nextp;
//return the data at this index
@blaquee
blaquee / gist:5788708
Last active December 18, 2015 13:19
ctfdefcon
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
typedef struct _llist {
struct _llist *next;
uint32_t tag;
char data[100];
}llist;
char* userBuf(llist* p)
{
while(1){
//reached end of list
if(p->next == 0){return 0;}
if(p->tag == 0x41414100)
{
//increment
return p->data;
}else{