Skip to content

Commit 471a1fa

Browse files
new file: Codecademy/helloworld.c
new file: Codedex/Python/19-Detention.py new file: Codedex/Python/20-99.bottles.py new file: Codedex/Python/21-Fizz-Buzz.py new file: Cryptohack/xor-properties.py deleted: Cryptohack/xor-str.py new file: Pwn.college/Program-interaction/28.py new file: Pwn.college/Program-interaction/29.c new file: Pwn.college/Program-interaction/30.c
1 parent bb2d728 commit 471a1fa

File tree

9 files changed

+111
-33
lines changed

9 files changed

+111
-33
lines changed

Codecademy/helloworld.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include <stdio.h>
2+
3+
/*
4+
This code snippet is written in C and defines a program that outputs
5+
the text "Hello World!" to the console. It includes the standard
6+
input-output library stdio.h and defines a main function.
7+
Inside the main function, it uses the printf function to print the message
8+
"Hello World!" followed by a newline character \n.
9+
*/
10+
11+
int main() {
12+
// output a line
13+
printf("Hello World!\n");
14+
}

Codedex/Python/19-Detention.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# detention.py
2+
3+
for i in range(100):
4+
print('I will not use Snapchat in class')

Codedex/Python/20-99.bottles.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# 99 Bottles of beer song
2+
3+
for bottle in range(99, 0, -1):
4+
print(f'{bottles} bottles of beer on the wall')
5+
print(f'{bottles} of beer')
6+
print('Take one down, pass it around')
7+

Codedex/Python/21-Fizz-Buzz.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"""
2+
# 21-Fizz-Buzz.py
3+
4+
Prints the numbers from 1 to 99, replacing multiples of 3 with "Fizz", multiples of 5 with "Buzz",
5+
and multiples of both 3 and 5 with "FizzBuzz".
6+
"""
7+
for i in range(1, 100, 1):
8+
if (i % 3 == 0) and (i % 5 == 0) == True:
9+
print("FizzBuzz")
10+
elif i % 3 == 0:
11+
print("Fizz")
12+
elif i % 5 == 0:
13+
print("Buzz")
14+
else:
15+
print(f"{i}")

Cryptohack/xor-properties.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from pwn import xor
2+
3+
k1=bytes.fromhex('a6c8b6733c9b22de7bc0253266a3867df55acde8635e19c73313')
4+
k2_3=bytes.fromhex('c1545756687e7573db23aa1c3452a098b71a7fbf0fddddde5fc1')
5+
flag=bytes.fromhex('04ee9855208a2cd59091d04767ae47963170d1660df7f56f5faf')
6+
7+
print(xor(k1,k2_3,flag))

Cryptohack/xor-str.py

Lines changed: 0 additions & 33 deletions
This file was deleted.

Pwn.college/Program-interaction/28.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# - the challenge checks for a specific parent process : python
2+
# - the challenge will check that the environment is empty (except LC_CTYPE, which is impossible to get rid of in some cases)
3+
4+
import subprocess
5+
result = subprocess.check_output(
6+
["/challenge/embryoio_level28"],
7+
env={"LC_CTYPE": "C"},
8+
stderr=subprocess.STDOUT
9+
)
10+
print(result.decode("utf-8"))

Pwn.college/Program-interaction/29.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include <stdio.h>
2+
#include <unistd.h>
3+
#include <sys/types.h>
4+
#include <sys/wait.h>
5+
6+
void pwncollege(char *argv[], char *env[])
7+
{
8+
execve("/challenge/embryoio_level29", argv, env);
9+
}
10+
11+
int main(int argc, char *argv[], char *env[])
12+
{
13+
pid_t fpid;
14+
15+
fpid = fork();
16+
// Create a fork and save the PID, PID 0 will be child process which is what we want to wait on
17+
18+
if (fpid == 0)
19+
{ // If we are onto the child process
20+
pwncollege(argv, env);
21+
}
22+
else
23+
{
24+
waitpid(fpid, NULL, 0); // Wait for child process to run before parent terminates *HINT* wait literally waits for the child process before terminating the parent.. that is what it does
25+
}
26+
return 0;
27+
}

Pwn.college/Program-interaction/30.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include <stdio.h>
2+
#include <unistd.h>
3+
#include <sys/types.h>
4+
#include <sys/wait.h>
5+
6+
void pwncollege(char *argv[], char *env[])
7+
{
8+
execve("/challenge/embryoio_level30", argv, env);
9+
}
10+
11+
int main(int argc, char *argv[], char *env[])
12+
{
13+
pid_t fpid;
14+
15+
fpid = fork();
16+
// Create a fork and save the PID, PID 0 will be child process which is what we want to wait on
17+
18+
if (fpid == 0)
19+
{ // If we are onto the child process
20+
pwncollege(argv, env);
21+
}
22+
else
23+
{
24+
waitpid(fpid, NULL, 0); // Wait for child process to run before parent terminates *HINT* wait literally waits for the child process before terminating the parent.. that is what it does
25+
}
26+
return 0;
27+
}

0 commit comments

Comments
 (0)