admin 发布的文章

国外很多大盘鸡都装了这东西。下载文件用。
两种加密方式:
1, user password
2, token:设置的secret
如果没设置的话,就是匿名登录。

#coding:utf-8
#!/usr/bin/env python


import time
import requests
import re
import sys

file_list=sys.argv[1]

data = '{"jsonrpc":"2.0","method":"aria2.getGlobalOption","id":1,"params":[]}'

with open(file_list, "r") as f:
    url_list= f.readlines()
    for ip in url_list:
        ip=ip.strip()
        url="http://"+ip+":6800/jsonrpc?tm="+str(int(time.time()))
        response = requests.post(url,data=data)
        html = response.content.decode('utf-8')
        headers = response.headers
        if(re.findall("Unauthorized",html)):
            pass
            #print(ip+" Aria2 Unauthorized\n")
        else:
            print(ip+" Anonymous Login Vul\n")

在以前的基础上精简了一下

#!/bin/sh

name=`basename $0 .sh`


function killv2() 
{
        pid=`ps -ef | grep v2ray | grep -v grep | awk '{print $2}'`
        kill -n 9 ${pid}
}

case $1 in
 us1|us2|us3|jp1|jp2|jp3|ru1|hk1)
        echo "start ${1}..."
        killv2
        nohup ./v2ray --config=v2ray_$1.json >/dev/null 2>&1 &
        ;;
        
 *)
        echo "Usage: sudo $name.sh [us1|us2|us3|jp1|jp2|jp3|ru1|hk1]"
        exit 1
        ;;
esac
exit 0

import itertools
>>> l = [(k, len(list(g))) for k, g in itertools.groupby('0000000000000')]
>>> len(l)
1
>>> l = [(k, len(list(g))) for k, g in itertools.groupby('0000000000001')]
>>> len(l)
2

(d)1{位数,} 也可以

https://gist.github.com/nannubest/998242

<?php

/*
* SQLite3 Class
* based on the code of miquelcamps
* @see http://7devs.com/code/view.php?id=67
*/

class DB{
  private $sqlite;
  private $mode;

  function __construct( $filename, $mode = SQLITE3_ASSOC ){
    $this->mode = $mode;
    $this->sqlite = new SQLite3($filename);

  }

  function __destruct(){
    @$this->sqlite->close();
  }

  function clean( $str ){
    return $this->sqlite->escapeString( $str );
  }

  function query( $query ){
    $res = $this->sqlite->query( $query );
    if ( !$res ){
      throw new Exception( $this->sqlite->lastErrorMsg() );
    }

    return $res;
  }

  function queryRow( $query ){
    $res = $this->query( $query );
    $row = $res->fetchArray( $this->mode );
    return $row;
  }

  function queryOne( $query ){
    $res = $this->sqlite->querySingle( $query );
    return $res;
  }

  function queryAll( $query ){
    $rows = array();
    if( $res = $this->query( $query ) ){
      while($row = $res->fetchArray($this->mode)){
        $rows[] = $row;
      }
    }
    return $rows;
  }

  function getLastID(){
    return $this->sqlite->lastInsertRowID();
  }
}

// initialize
$db = new DB( 'database.sqlite' );

// create the database structure
$query = 'CREATE TABLE IF NOT EXISTS "foobar" (
            "id" INTEGER PRIMARY KEY AUTOINCREMENT,
            "name" TEXT
          );';
$db->query( $query );

// insert some data to the database
$query = array(
  "INSERT INTO foobar VALUES(1,'LOLOLOL');",
  "INSERT INTO foobar VALUES(2,'Lorem Ipsum....');"
  );

foreach($query as $key):
  $db->query( $key );
endforeach;

// query example, multiple rows
$users = $db->queryAll( "SELECT * FROM foobar" );

// query example, one row
$search = 'Lorem Ipsum....';
$user_info = $db->queryRow( sprintf( "SELECT * FROM foobar WHERE name = '%s'", $db->clean( $search ) ) );

// query example, one result
$total_users = $db->queryOne( "SELECT COUNT(*) FROM foobar" );

// insert query
$insert = array(
  'id' => 3,
  'text' => 'Testing'
);
$db->query( sprintf( "INSERT INTO foobar VALUES ( %s, '%s' )", $db->clean ( $insert['id'] ), $db->clean( $insert['text'] ) ) );

?>