hexdumper task
This commit is contained in:
parent
06194f0903
commit
afade771fa
10
TODO.md
10
TODO.md
|
@ -1,10 +0,0 @@
|
||||||
# Things that tasks would be cool
|
|
||||||
|
|
||||||
## Kryptography
|
|
||||||
- [ ] Caesar-encryption, decryption, brute force
|
|
||||||
|
|
||||||
## Math
|
|
||||||
- [ ] calculate determinant of a matrix
|
|
||||||
|
|
||||||
## General Tech
|
|
||||||
- [ ] Regex
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
This is a list of tasks that would be cool to add.
|
||||||
|
|
||||||
|
* Tasks
|
||||||
|
** Basic
|
||||||
|
*** Files
|
||||||
|
- ( ) Hex dumper
|
||||||
|
*** Networking
|
||||||
|
- ( ) Mini curl
|
||||||
|
*** Packaging
|
||||||
|
- ( ) Installing a package to your system
|
||||||
|
- ( ) Building a library
|
||||||
|
|
||||||
|
** Cryptography
|
||||||
|
*** Signature
|
||||||
|
- ( ) Check a signature with OpenSSL
|
77
Tasks.md
77
Tasks.md
|
@ -178,7 +178,7 @@ Difficulty: 2/5
|
||||||
- How many possible strings consisting of 16 alphanumeric characters can exist?
|
- How many possible strings consisting of 16 alphanumeric characters can exist?
|
||||||
- Add the possibility for a second argument `-v` that indicates your script should be more
|
- Add the possibility for a second argument `-v` that indicates your script should be more
|
||||||
verbose.
|
verbose.
|
||||||
- print the security bits ($log_2(L)$ where $L$ is the total number of possibilites) when the
|
- print the security bits ($log_2(L)$ where $L$ is the total number of possibilities) when the
|
||||||
`-v` flag is applied
|
`-v` flag is applied
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
@ -287,3 +287,78 @@ A regex that fullfills the requirements is `\b[a-z][AEIOUaeiou]([a-w]|[A-W])`.
|
||||||
[Code Example](src/tasks/regex.py)
|
[Code Example](src/tasks/regex.py)
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
## Making a Hexeditor
|
||||||
|
|
||||||
|
In this section, we're building a little hexeditor. You will be able to install
|
||||||
|
it on your system and use it instead of the `hexdump` and `xxd` built into most
|
||||||
|
Linux distributions.
|
||||||
|
|
||||||
|
Hexdumping is actually really simple, all you have to do is read a file and
|
||||||
|
print it's direct content interpreted as numbers in hexadecimal. Apply some
|
||||||
|
fancy string formatting and we're done!
|
||||||
|
|
||||||
|
The editing part is a lot harder. It requires us to build a functioning TUI -
|
||||||
|
Terminal User Interface, as working with command line arguments or regular
|
||||||
|
reading from stdin won't help us much for editing a file. (if that's your thing,
|
||||||
|
use `ed`.).
|
||||||
|
|
||||||
|
Note: If you're looking for a great, fully featured hexeditor, I'd recommend
|
||||||
|
`bvi` ("binary vi"), which is packaged by most distributions.
|
||||||
|
|
||||||
|
-> `apt-get install bvi`
|
||||||
|
|
||||||
|
Note: I have no Idea how to install a python script as executable on windows, I
|
||||||
|
don't like windows either, so no support for installing stuff on windows.
|
||||||
|
|
||||||
|
### A. Hexdumper
|
||||||
|
Difficulty: 2/5
|
||||||
|
|
||||||
|
|
||||||
|
1. Dump the data of [data/metasyntactic.md](./data/metasyntactic.md) -- In
|
||||||
|
Hexadecumal.
|
||||||
|
2. Make the dumped Bytes look pretty, something like the example below:
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Hexdump Example Display</summary>
|
||||||
|
|
||||||
|
`data/metasyntactic.md` looks like this when hexdumped:
|
||||||
|
|
||||||
|
```text
|
||||||
|
Line Data
|
||||||
|
=================================================
|
||||||
|
0000000 ┃ 6f4e 6574 203a 6854 7369 6920 2073 6874
|
||||||
|
0000010 ┃ 2065 6957 696b 6570 6964 2061 6170 6567
|
||||||
|
0000020 ┃ 6620 726f 6d20 7465 7361 6e79 6174 7463
|
||||||
|
0000030 ┃ 6369 7620 7261 6169 6c62 7365 6920 206e
|
||||||
|
0000040 ┃ 6e45 6c67 7369 2c68 3220 3230 2d33 3930
|
||||||
|
0000050 ┃ 302d 2e35 4620 6e69 2064 6874 0a65 7075
|
||||||
|
0000060 ┃ 7420 206f 6164 6574 6f20 6972 6967 616e
|
||||||
|
0000070 ┃ 206c 685b 7265 5d65 6828 7474 7370 2f3a
|
||||||
|
0000080 ┃ 652f 2e6e 6977 696b 6570 6964 2e61 726f
|
||||||
|
0000090 ┃ 2f67 6977 696b 4d2f 7465 7361 6e79 6174
|
||||||
|
00000a0 ┃ 7463 6369 765f 7261 6169 6c62 2965 0a2e
|
||||||
|
00000b0 ┃ 230a 4d20 7465 7361 6e79 6174 7463 6369
|
||||||
|
00000c0 ┃ 7620 7261 6169 6c62 0a65 230a 2023 6f54
|
||||||
|
00000d0 ┃ 6c6f 0a73 460a 6f72 206d 6957 696b 6570
|
||||||
|
00000e0 ┃ 6964 2c61 7420 6568 6620 6572 2065 6e65
|
||||||
|
00000f0 ┃ 7963 6c63 706f 6465 6169 540a 6968 2073
|
||||||
|
0000100 ┃ 7261 6974 6c63 2065 7369 6120 6f62 7475
|
||||||
|
0000110 ┃ 6d20 7465 7361 6e79 6174 7463 6369 7620
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Hints</summary>
|
||||||
|
|
||||||
|
TODO: add hints
|
||||||
|
|
||||||
|
</details>
|
||||||
|
<details>
|
||||||
|
<summary>Solution</summary>
|
||||||
|
|
||||||
|
TODO: formulate solution text
|
||||||
|
|
||||||
|
[Code Example](src/tasks/hexdumper-a.py)
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
import sys
|
||||||
|
|
||||||
|
def main():
|
||||||
|
# parse args
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
Loading…
Reference in New Issue