substr

DVWA 攻击平台测试

匿名 (未验证) 提交于 2019-12-02 23:06:17
DVWA是OWASP官方提供的一个做渗透测试的平台 1.SQL injection 1.利用特殊字符验证绕过SQL 当我们输入1的时候 ID有一个回显 当我们接着输入''的时候,SQL回显报错 初步可以判断这里存在SQL注入点 绕过了验证 利用”order by 1。2。3.。。-- “猜测一下数据的列数 当输入1‘ order by 2-- 时和第一种情况是一样的,验证到3的时候 可以获得这个数据库中含有2列数据 3.通过得到连接数据库账户信息、数据库名称、数据库版本信息。利用user(),及database(),version()等三个内置函数。 可以查询到当前SQL版本是5.5.53 操作系统 信息 1'and 1=2 union select 1,@@global.version_compile_os from mysql.user -- 5.测试连接数据库权限: 1’ and ord(mid(user(),1,1))=114 -- 猜测数据库中是否存在root用户若返回正常说明是root 6.查询mysql数据库,所有数据库名字:这里利用mysql默认的数据库infromation_scehma,该数据库存储了Mysql所有数据库和表的信息。 这个数据库中所有成员的信息已经显示出来了。 以上是注入一个SQL数据库的所有步骤。总结一下: 1、寻找注入点

SQL注入漏洞总结

匿名 (未验证) 提交于 2019-12-02 23:05:13
目录: 一、 SQL注入漏洞介绍 二、修复建议 三、通用姿势 四、具体实例 五、各种绕过 一、SQL注入漏洞介绍: 二、修复建议 使用参数化查询接口或在代码级对带入SQL语句中的外部参数进行转义或过滤; 对于整数,判断变量是否符合[0-9]的值;其他限定值,也可以进行合法性校验; 对于字符串,对SQL语句特殊字符进行转义(单引号转成两个单引号,双引号转成两个双引号)。 三、通用姿势 3.1 通过以下操作先大概判断是否存在注入点 如果参数(id)是数字,测试id=2-1与id=1返回的结果是否相同,如果做了2-1=1的运算,说明可能存在数字型注入。如果要用+号运算的话,因为URL编码的问题,需要把加好换成%2B,如id=1%2B1 在参数后面加单引号或双引号,判断返回结果是否有报错 3.2 如果存在注入,利用注入获取信息 3.2.1 查询结果如果可以直接返回 利用联合查询一步步的获取信息,如: //获取数据库名称,注意联合查询要求前后查询的列数和数据类型必须对应1' union select schema_name from information_schema.schemata -- //根据上一步获取的数据库名称,获取表名1' union select table_name from information_schema.tables where table_schema=

C++ substr 函数解析

匿名 (未验证) 提交于 2019-12-02 23:03:14
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/CV2017/article/details/85164749 功能 从已有的字符串中截取字符串片段 用法 string substr (起始位置, 字符个数); //返回截取的从起始位置开始满字符个数的字符片段,字符个数包含了起始位置的字符 返回值 string 类型 示例 #include <iostream> #include <string> using namespace std; int main() { string str("abcdefg"); string sNeed = str.substr(0, 3); // 0 表示在 a 的位置,3 表示含 a 在内开始连续的 3 个字符,那么就是 abc cout << sNeed << endl; } 输出结果:abc 文章来源: C++ substr 函数解析

306. Additive Number/842. Split Array into Fibonacci Sequence -- back tracking

匿名 (未验证) 提交于 2019-12-02 22:56:40
class Solution { public boolean isAdditiveNumber(String num) { int len = num.length(); if(len<3) return false; return dfs(new ArrayList<>(), num, 0); } private boolean dfs(List<Long> curResult, String s, int start){ if(curResult.size() >=3 && start==s.length()){ return true; } boolean flag = false; for(int i=1; i<=s.length()-2; i++){ if(start+i >s.length()) break; int size = curResult.size(); String substr = s.substring(start,start+i); if(substr.length()>1 && substr.charAt(0) == '0') continue; long subnum = Long.valueOf(substr); if(size>=2) if(curResult.get(size-1) + curResult.get(size-2) !=

Python――解决工作中的小问题

匿名 (未验证) 提交于 2019-12-02 22:51:30
问题描述: 业务系统的会员信息表进入到数仓中,存在数据缺失,其造成这一问题的原因是后台会手动处理一些数据(卸数等ETL流程不存在问题),造成卸数时取不到这些数据,经过考虑,决定用Python解决这一问题。 以下代码中设计到的一些比较有用的函数及问题: 1、比较两个list,取出一个list不存在于另一个list中的值 final=set(data_userid).difference(set(data_memberid)) 2、将数据框dataframe写入数据库,用以下方法很容易实现 engine=create_engine('oracle://pdm:dwPDM2018#@192.168.0.72:1521/pdm', echo=True) data.convert_objects(convert_numeric=True).to_sql('t01_e3_member_info_lxh', con=engine, if_exists='replace', index=False, index_label=None) 3、当利用Python执行insert into tablename1 select * from tablename2语句时,若tablename2中存在空数据,若使用import pandas.io.sql as sql;sql.read_sql(sqlstr1

PHP的经典常用算法值得收藏

匿名 (未验证) 提交于 2019-12-02 22:11:45
<? //-------------------- // 基本数据结构算法 //-------------------- //二分查找(数组里查找某个元素) function bin_sch ( $array , $low , $high , $k ){ if ( $low <= $high ){ $mid = intval (( $low + $high )/ 2 ); if ( $array [ $mid ] == $k ){ return $mid ; } elseif ( $k < $array [ $mid ]){ return bin_sch ( $array , $low , $mid - 1 , $k ); } else { return bin_sch ( $array , $mid + 1 , $high , $k ); } } return - 1 ; } //顺序查找(数组里查找某个元素) function seq_sch ( $array , $n , $k ){ $array [ $n ] = $k ; for ( $i = 0 ; $i < $n ; $i ++){ if ( $array [ $i ]== $k ){ break ; } } if ( $i < $n ){ return $i ; } else { return - 1 ; } } /

PHP_加密解密字符串

匿名 (未验证) 提交于 2019-12-02 22:11:45
PHP_加密解密字符串.php <?php //加解密字符串函数,可以加密中文 /* //加密 echo $encode = authcode('爱迪生', 'ENCODE', '3'); //DvAHOdGFqa8xK4CDLnbr2mE //解密 echo $decode = authcode($encode, 'DECODE', '3'); //爱迪生 //密钥 $auth_key = 34577; 参数:$string字符串,$operation加密还是解密,$key密钥 */ function authcode($string, $operation, $key = '') { $key = md5($key ? $key : $GLOBALS['auth_key']); $key_length = strlen($key); $string = $operation == 'DECODE' ? base64_decode($string) : substr(md5($string . $key), 0, 8) . $string; $string_length = strlen($string); $rndkey = $box = array(); $result = ''; for ($i = 0; $i <= 255; $i++) { $rndkey[$i] =

介绍三种PHP加密解密算法

匿名 (未验证) 提交于 2019-12-02 22:10:10
PHP加密解密算法 这里主要介绍三种常用的加密解密算法: 方法一: 1 /** 2 * @param $string 要加密/解密的字符串 3 * @param string $operation 类型,ENCODE 加密;DECODE 解密 4 * @param string $key 密匙 5 * @param int $expiry 有效期 6 * @return string 7 */ 8 function authcode($string, $operation = 'DECODE', $key = 'encrypt', $expiry = 0) 9 { 10 // 动态密匙长度,相同的明文会生成不同密文就是依靠动态密匙 11 $ckey_length = 4; 12 // 密匙 13 $key = md5($key ? $key : $GLOBALS['discuz_auth_key']); 14 // 密匙a会参与加解密 15 $keya = md5(substr($key, 0, 16)); 16 // 密匙b会用来做数据完整性验证 17 $keyb = md5(substr($key, 16, 16)); 18 // 密匙c用于变化生成的密文 19 $keyc = $ckey_length ? ($operation == 'DECODE' ? substr(

PHP Extract numbers from a string

断了今生、忘了曾经 提交于 2019-12-02 19:50:50
问题 I want to extract numbers from a string in PHP like following : if the string = 'make1to6' i would like to extract the numeric character before and after the 'to' substring in the entire string. i.e. 1 and 6 are to be extracted i will be using these returned values for some calculations.' i would like to extract the numeric character before and after the 'to' substring in the entire string. i.e. 1 and 6 are to be extracted The length of the string is not fixed and can be a max of 10

C Tokenizer (and it returns empty too when fields are missing. yay!)

倾然丶 夕夏残阳落幕 提交于 2019-12-02 18:41:18
问题 See also: Is this a good substr() for C? strtok() and friends skip over empty fields, and I do not know how to tell it not to skip but rather return empty in such cases. Similar behavior from most tokenizers I could see, and don't even get me started on sscanf() (but then it never said it would work on empty fields to begin with). I have been on a roll and feeling sleepy as well, so here it goes for review: char* substr(const char* text, int nStartingPos, int nRun) { char* emptyString =