Skip to content

Commit

Permalink
🗓 Mar 26, 2023 9:07:40 PM
Browse files Browse the repository at this point in the history
🚀 add int type to list_to_str
  • Loading branch information
securisec committed Mar 27, 2023
1 parent 602ca9b commit 737f27d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Fix:
Code:
☐ add more examples in docstrings
☐ Luhn validator https://guptaavi352.medium.com/ctflearn-writeups-9f247c2fe94c
☐ 🚀 add crib for xor bruteforce

New ideas:
☐ rubber ducky encode/decode
Expand All @@ -19,6 +20,9 @@ New ideas:
☐ qr create
☐ random from state
☐ rot8000
☐ us-ascii 7bit 20127 https://gchq.github.io/CyberChef/#recipe=Encode_text('US-ASCII%20(7-bit)%20(20127)') 걳걵걮걻걢갴걳갳걟갱갲갸걟갱갵걟걢갱건걟걲갳걭갴거거갱걮걧걽
☐ vigenere make aware of all cases/numbers/specials. i.e. npcdhzaon{a4Rmp!_K1N5q0p_4vQfKkT1uA3R} key victory shaktictf{y4Yyy!_M1S5i0n_4cCoMpL1sH3D}
☐ ascii shift cipher kqfl ? snyjHYK"8fwymdxf~xdm8qq5$ = niteCTF{3arth_says_h3ll0} somewhat

Bug:

Expand Down Expand Up @@ -55,6 +59,7 @@ Misc:
☐ cyberchef recipe to chepy recipe converter

Archive:
✔ for join_by handle int
✔ ip from int and vice versa @project(New ideas)
✔ subsection. regex select from state and run all subsequent operations on the selected data @project(New ideas)
✔ base 91 @project(Methods)
Expand Down
5 changes: 5 additions & 0 deletions chepy/modules/dataformat.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ def list_to_str(self, join_by: Union[str, bytes] = " ") -> DataFormatT:
"a,b,c"
"""
assert isinstance(self.state, list), "Data in state not a list"
# convert the list of items in state appropiately
if isinstance(join_by, str):
self.state = [str(x) for x in self.state]
elif isinstance(join_by, bytes):
self.state = [bytes(x) for x in self.state]
self.state = join_by.join(self.state)
return self

Expand Down
2 changes: 2 additions & 0 deletions tests/test_dataformat.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ def test_to_list():

def test_list_to_str():
assert Chepy(["a", "b", "c"]).list_to_str(",").o == "a,b,c"
assert Chepy([1, 2, 3]).list_to_str((".")).o == "1.2.3"
assert Chepy([b"a", b"b"]).list_to_str(b".").o == b"a.b"


def test_join_list():
Expand Down

0 comments on commit 737f27d

Please sign in to comment.