print('----- part1 -----') for i in range(1,25): print(str(i) + ' : ' + rot(i,part1)) print('----- part2 -----') for i in range(1,25): print(str(i) + ' : ' + rot(i,part2))
% ./msieve -q -v -e 97139961312384239075080721131188244842051515305572003521287545456189235939577 Msieve v. 1.52 (SVN unknown) Sun May 27 12:28:20 2018 random seeds: 6e686328 e437b032 factoring 97139961312384239075080721131188244842051515305572003521287545456189235939577 (77 digits) searching for 15-digit factors searching for 20-digit factors commencing quadratic sieve (77-digit input) using multiplier of 17 using generic 32kb sieve core sieve interval: 12 blocks of size 32768 processing polynomials in batches of 17 using a sieve bound of 922619 (36471 primes) using large prime bound of 92261900 (26 bits) using trial factoring cutoff of 26 bits polynomial 'A' values have 10 factors restarting with 19257 full and 192162 partial relations 36824 relations (19257 full + 17567 combined from 192162 partial), need 36567 begin with 211419 relations reduce to 52152 relations in 2 passes attempting to read 52152 relations recovered 52152 relations recovered 40908 polynomials attempting to build 36824 cycles found 36824 cycles in 1 passes distribution of cycle lengths: length 1 : 19257 length 2 : 17567 largest cycle: 2 relations matrix is 36471 x 36824 (5.3 MB) with weight 1107805 (30.08/col) sparse part has weight 1107805 (30.08/col) filtering completed in 3 passes matrix is 25811 x 25874 (4.1 MB) with weight 862421 (33.33/col) sparse part has weight 862421 (33.33/col) saving the first 48 matrix rows for later matrix includes 64 packed rows matrix is 25763 x 25874 (2.6 MB) with weight 618823 (23.92/col) sparse part has weight 423573 (16.37/col) commencing Lanczos iteration memory use: 2.6 MB lanczos halted after 409 iterations (dim = 25759) recovered 15 nontrivial dependencies prp39 factor: 299681192390656691733849646142066664329 prp39 factor: 324144336644773773047359441106332937713 elapsed time 00:00:12
crypto2.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
n = 97139961312384239075080721131188244842051515305572003521287545456189235939577 p = 299681192390656691733849646142066664329 q = 324144336644773773047359441106332937713 e = 65537 c = 77361455127455996572404451221401510145575776233122006907198858022042920987316
a = (p - 1) * (q - 1)
x = 0 whileTrue: if (a * x + 1) % e == 0: d = (a * x + 1) / e break x = x + 1
m = pow(c, d, n) flag = ('%x' % m).decode('hex') print(flag)
Pwn
condition
指定されたhost, portに接続すると名前を尋ねられる
1 2 3
% nc pwn1.chall.beginners.seccon.jp 16268 Please tell me your name...myname Permission denied