ctfs | notes and code on past CTFs | Hacking library
kandi X-RAY | ctfs Summary
kandi X-RAY | ctfs Summary
notes and code on past CTFs
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Try to recover a RSA key from a private key
- Decode a cookie value
- Return the modular inverse of a
- Compute the Euclidean distance
- Tests to see if a perfect square is a perfect square square
- Check if n is a perfect square square
- Return the length of an integer
- Return the square root of n
- Test test
- Convert a rational value to a contraction
- Return a list of rational objects corresponding to a cont fraction
- Convert a fractional fraction to a rational number
- Read a chunk from a file
- Compute the CRC32 of data
- Read a png file
- Creates an image with scipy
- Return the inverse of the modulo e
- Pretty print IP
- Prints the difference between two strings
- Authenticate a user
- Parse the request
- Generate attack vector
- Test whether oracle is True
- Returns a mysql union
- Solve the CTC
- Run a command via HTTP
ctfs Key Features
ctfs Examples and Code Snippets
Community Discussions
Trending Discussions on ctfs
QUESTION
i'm currently in programming studies and do CTFs in my spare time to get a few extra skills.
Right now i'm facing a binary (i dont have the source code but could ghidra it) which:
- putchar a single char
- clock_nanosleep for X seconds
- putchar a single char
- clock_nanosleep for Y seconds
- ...
(I've strace the binary and saw that the binary uses "clock_nanosleep" with "CLOCK_REALTIME")
My question is: Is there a way to execute the binary while skipping the "clock_nanosleep" ?
My guesses:
- Maybe block him the time.h lib so he cant execute "clock_nanosleep" ?
- Maybe modify the "CLOCK_REALTIME" so that the program thinks the time have passed and finishes the "clock_nanosleep" ?
Extra informations:
File : ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=5eca63735d90098f20f45ca172e242372994976e, for GNU/Linux 3.2.0, stripped
Strings : /lib64/ld-linux-x86-64.so.2 libc.so.6
ANSWER
Answered 2021-Sep-08 at 17:49You can LD_PRELOAD
to neuter the clock_nanosleep
call:
QUESTION
I create a Web-Bruteforce project with Python for CTFs. I ran it.
As you can see something's wrong. It isn't regular. How can I print them more beautifully? These are my codes:
...ANSWER
Answered 2021-Jan-06 at 12:51You can specify a size for the formatting and the content will be padded with spaces
QUESTION
I am beginning to solve programming CTFs in Python when I came accross a challenge for automating math calculations to get the flag.
The source code of the welcoming page looks like this:
...ANSWER
Answered 2020-Nov-04 at 21:47response.text
will give you a str
, not byte
s but response.content
will give you byte
s.
Choose the type you want to use and use it consistently.
re
will handle bytes if the regular expression is byte
s as well.
QUESTION
begin TLDR;
I want to write a python3 script to scan through the memory of a running windows process and find strings.
end TLDR;
This is for a CTF binary. It's a typical Windows x86 PE file. The goal is simply to get a flag from the processes memory as it runs. This is easy with ProcessHacker you can search through the strings in the memory of the running application and find the flag with a regex. Now because I'm a masochistic geek I strive to script out solutions for CTFs (for everything really). Specifically I want to use python3, C# is also an option but would really like to keep all of the solution scripts in python.
Thought this would be a very simple task. You know... pip install some library written by someone that's already solved the problem and use it. Couldn't find anything that would let me do what I need for this task. Here are the libraries I tried out already.
ctypes - This was the first one I used, specifically ReadProcessMemory. Kept getting 299 errors which was because the buffer I was passing in was larger than that section of memory so I made a recursive function that would catch that exception, divide the buffer length by 2 until it got something THEN would read one byte at a time until it hit a 299 error. May have been on the right track there but I wasn't able to get the flag. I WAS able to find the flag only if I knew the exact address of the flag (which I'd get from process hacker). I may make a separate question on SO to address that, this one is really just me asking the community if something already exists before diving into this.
pymem - A nice wrapper for ctypes but had the same issues as above.
winappdbg - python2.x only. I don't want to use python 2.x.
haystack - Looks like this depends on winappdbg which depends on python 2.x.
angr - This is a possibility, Only scratched the surface with it so far. Looks complicated and it's on the to learn list but don't want to dive into something right now that's not going to solve the issue.
volatility - Looks like this is meant for working with full RAM dumps not for hooking into currently running processes and reading the memory.
My plan at the moment is to dive a bit more into angr to see if that will work, go back to pymem/ctypes and try more things. If all else fails ProcessHacker IS opensource. I'm not fluent in C so it'll take time to figure out how they're doing it. Really hoping there's some python3 library I'm missing or maybe I'm going about this the wrong way.
...ANSWER
Answered 2020-Jun-18 at 04:18QUESTION
Im having issues parsing out each child node within an xml file. The number of nodes can change per Instrument_Root. For instance, Instrument_Watch is NULL here, but will be populated in other instances after this. My goal is to have each child node parsed individually (Instrument_Ratings, Instrument_Attribute_Ratings, Instrument_Organization, Instrument_Supports, etc.)
I tried doing the following, but it just returned the first intance repeatedly - there are 3700 Instrument_Root in the file, and Instrument_Rating for this one Instrument_Root was repeated 3700 times. I also ran into errors with etree due to the namespace.
...ANSWER
Answered 2020-Apr-07 at 14:45The source of your problem is that your XML has a default namespace
(http://www.XXXXX.com
), so each attempt to locate an element must
include this namespace (your code failed on this detail).
To process your XML file I used the following code:
Import:
QUESTION
I'm planning to use GitHub pages to create a blog, including writeups of CTFs. Due to the terms of these, the writeups cannot be released until a specific date. I'm planning to have a master
branch that is the one published on the site, but I'd also like an offline
branch containing unpublished writeups, which should never touch the remote until merged into master. Is there a way to do this using Git/GitHub?
ANSWER
Answered 2020-Feb-03 at 11:54- You could keep the
offline
branch in your local copy, and only push to the remote when you want to publish it. Alternatively, keep two remote copies, one public and one private. Use the private copy to maintain a remote backup of your code, and the public copy to publish your website. Push to the public copy only what you want, when appropriate for you. - You could keep the GitHub repository that generates the web page private. Then, only the generated output using the code from the
master
branch will be publicly visible (as your web page). You can keep your private code in another branch in the remote and merge it withmaster
when you wish to.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ctfs
You can use ctfs like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page