Comments (3)
Hi Arshpreet,
Looking at the code given you can see this
enc ''.join([chr((ord(flag[i]) << 8) + ord(flag[i + 1])) for i in range(0, len(flag), 2)])
I don't know how familiar you are with python, but this takes two ascii values of the characters from our flag. Here:
chr((ord(flag[i]) << 8) + ord(flag[i + 1])
Shifts the first by 8 bits to the left and adds the ascii value of the following letter. Then converted back to a character, this gives us: 灩捯䍔䙻ㄶ形楴獟楮獴㌴摟潦弸彥ㄴㅡて㝽
You could easily try to solve with code like this:
for i in range(0,len(enc)):
... print(chr(ord(enc[i]) >> 8),end='')
...
pcCF1_isis3do__1107
But as you can see, the bit shift on its own is not enough. From here you could have guessed it to be a difference in encoding. I decided to use the tool cyberchef (as mentioned in the writeup), cause it solves it for you. Essentially we are missing a few pieces of the flag. You could also try bruteforcing it, and find the pieces one by one.
for i in range(0,len(enc)):
... print(ord(enc[i]) >> 8)
...
112
99
67
70
49
95
105
115
105
115
51
100
111
95
95
49
49
48
55
If I elaborate, here are all the ascii values after the bit shift. We know the output will be only printable characters, so you could try to either find the right encoding, or try and find what two numbers in the printable character range give you the values above.
I prefer the cyberchef
route just for convenience. Let me know if there is something else, you'd like explained.
Note: My explanation is certainly not the only way or the best way to do it. I recommend doing more research online :)
from picoctf-2021-writeups.
Thank you so much for the efforts.
One more thing, is there any way I can "join" you. I mean I saw it in many talks that you should have a community to get into cyber security and I have none for now and I don't know where to start.
Anything?
from picoctf-2021-writeups.
You can join the PicoCTF discord server here: https://discord.com/invite/WQGdYaB
There should be a section for people that are looking for a team :) You can find some people there.
Have a good one and keep learning! 🥇
from picoctf-2021-writeups.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from picoctf-2021-writeups.