Skip to content

Commit

Permalink
chapter: Reformat content
Browse files Browse the repository at this point in the history
Reformat content to make it publishable via Docusaurus.

The `pwntools-intro` section was previously stored outside the
`chapters/` directory. Move it inside the `chapters/` directory.

Update formatting, links and configuration file (`config.yaml`) to new
structure.

Reformat Python code using `black`.

Apply linting (via `markdownlint-cli`) to Markdown files.

Signed-off-by: Razvan Deaconescu <[email protected]>
  • Loading branch information
razvand committed Jan 2, 2024
1 parent 1c58df5 commit 031a96a
Show file tree
Hide file tree
Showing 104 changed files with 4,830 additions and 4,143 deletions.
4 changes: 2 additions & 2 deletions COPYING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ A copy of each license is below.

Copy of CC BY-SA 4.0:

```
```text
Attribution-NonCommercial-ShareAlike 4.0 International
=======================================================================
Expand Down Expand Up @@ -449,7 +449,7 @@ Creative Commons may be contacted at creativecommons.org.

Copy of BSD-3-Clause:

```
```text
Copyright 2021 University POLITEHNICA of Bucharest
Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion chapters/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ slug: /

This is a landing page for your course.

Here you will add infomation about your course that a student might want to know at first glance.
Here you will add information about your course that a student might want to know at first glance.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
f = open("../flag")
flag = f.readline().strip()
f.close()
char = '\n'
char = "\n"

res = []
for i in range(0, len(flag)):
res += [ord(flag[i]) - ord(char)]

print "{" + ", ".join("{}".format(r) for r in res) + "};"
print("{" + ", ".join("{}".format(r) for r in res) + "};")
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
from pwn import *

flag = "SSS_CTF{0bad3910f14d10569b8bfe11aa1081e970e72e}\x00"
flag = ''.join(chr((ord(x) - 13) & 0xff) for x in flag)
flag = "".join(chr((ord(x) - 13) & 0xFF) for x in flag)
parts = unpack_many(flag, 32)

for i in range(len(parts)):
print('strvec[%d] = 0x%x;' % (i, parts[i]))
print("strvec[%d] = 0x%x;" % (i, parts[i]))


def encrypt(data):
res = map(ord, data)
n = len(data)
print(hexdump(data))
for i in range(n / 2):
res[i] = res[i] ^ res[n - i - 1]
res[n - i - 1] = (res[n - i - 1] - 1) & 0xff
return ''.join(map(chr, res))
res = map(ord, data)
n = len(data)
print(hexdump(data))
for i in range(n / 2):
res[i] = res[i] ^ res[n - i - 1]
res[n - i - 1] = (res[n - i - 1] - 1) & 0xFF
return "".join(map(chr, res))


binary = ELF("./phone_home")
context.arch = 'i386'
context.arch = "i386"

func_ea = binary.symbols["gen_flag"]
chunk = binary.read(func_ea, 4096)
func_sz = chunk.find(asm('ret')) + 1
print('Function size: 0x%x' % func_sz)
func_sz = chunk.find(asm("ret")) + 1
print("Function size: 0x%x" % func_sz)

func = encrypt(chunk[:func_sz])
binary.write(func_ea, func)
Expand Down
Loading

0 comments on commit 031a96a

Please sign in to comment.