Skip to main content
  1. CTF Writeups/
  2. scriptCTF 2025/

Div

·
Misc 100pts 720 Solves Decimal Python
subzcuber
Author
subzcuber
i like to imagine i’m funny

Author: NoobMaster

I love division


the python server code was given in chall.py

chall.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
import os
import decimal
decimal.getcontext().prec = 50

secret = int(os.urandom(16).hex(),16)
num = input('Enter a number: ')

if 'e' in num.lower():
    print("Nice try...")
    exit(0)

if len(num) >= 10:
    print('Number too long...')
    exit(0)

fl_num = decimal.Decimal(num)
div = secret / fl_num

if div == 0:
    print(open('flag.txt').read().strip())
else:
    print('Try again...')

basically you want to input a number large enough that it divides the 16bit secret to give zero, but you have certain checks preventing you from inputting large numbers

lets have a look at the decimal python package being used

and immediately we see this

A decimal number is immutable. It has a sign, coefficient digits, and an exponent. To preserve significance, the coefficient digits do not truncate trailing zeros. Decimals also include special values such as Infinity, -Infinity, and NaN. The standard also differentiates -0 from +0.

Infinity is only 8 characters and bypasses the checks to give us the flag

❯ nc play.scriptsorcerers.xyz 10166
Enter a number: Inf
scriptCTF{70_1nf1n17y_4nd_b3y0nd_75409d50f3a7}
Reply by Email

Related

Emoji
Misc 100 Pts 513 Solves Unicode Emoji
emoji
The Martian
Misc 50pts 647 Solves Binwalk
simple binwalk
Just Some Avocado
For 302pts 353 Solves Rockyou Fcrackzip Audacity Spectogram
my hashcat broke :(