Last active
August 7, 2023 04:50
-
-
Save ilobmirt/1b1c6200b9aad6e579ee875bde6af82e to your computer and use it in GitHub Desktop.
Simple Git for Dos Proof of Concept
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Steps to use this | |
----------------- | |
1) compile randstr.c ==> randstr.exe using DJGPP's gcc | |
- gcc randstr.c -std=c99 -o randstr.exe | |
2) copy both randstr.exe and sgit.bat to your local bin directory | |
3) Verify you have curl and tar installed | |
4) Now you can pull any github project onto your freedos machine :) Enjoy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
char rand_char(){ | |
char printable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"; | |
int size = (int)sizeof(printable); | |
int rindex=rand() % size; | |
return printable[rindex]; | |
} | |
int main(int argc, char **argv){ | |
int ret_code=0; | |
int length; | |
srand(time(NULL)); | |
if(argc!=2){ | |
ret_code=1; | |
printf("ERROR: NEEDS EXACTLY ONE ARGUMENT"); | |
} else { | |
length=atoi(argv[1]); | |
for(int index=0;index<length;index++){ | |
printf("%c",rand_char()); | |
} | |
}; | |
return ret_code; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
SET GIT_URL=https://github.com | |
SET GIT_USER=%1 | |
SET GIT_PROJECT=%2 | |
SET GIT_BRANCH=%3 | |
SET GIT_TARGET=%GIT_URL%/%GIT_USER%/%GIT_PROJECT%/tarball/%GIT_BRANCH% | |
SET /E TMPNAME=randstr 8 | |
ECHO GIT REPOSITORY - %GIT_USER%/%GIT_PROJECT%/%GIT_BRANCH% | |
ECHO TEMP FILE - %TMPNAME%.TAR.GZ | |
curl -LJk %GIT_TARGET% -o %TMPNAME%.gz | |
tar -xfi. %TMPNAME%.gz | |
del %TMPNAME%.gz | |
ECHO FINISHED GIT PULL | |
:END | |
SET GIT_URL= | |
SET GIT_USER= | |
SET GIT_PROJECT= | |
SET GIT_BRANCH= | |
SET GIT_TARGET= | |
SET TMPNAME= |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nice =)