2017年9月17日星期日

adb安装与使用,frida测试

0x01 adb安装与使用
https://developer.android.com/studio/index.html
下载android开发IDE
android-studio-bundle-162.4069837-windows.exe

1.下载用7z打开安装文件
2.$TEMP 目录下android-sdk.7z文件,把它提取出来
3.用7z打开android-sdk.7z,把platform-tools解压出来
4.将adb.exe复制到C:Windows\system32与SysWOW64
5.将AdbWinApi.dll与AdbWinUsbApi.dll复制到C:Windows\SysWOW64

然后打开cmd就可以运行adb了


用0.4.6的 adb.exe   AdbWinApi.dll
用2.3.3的 AdbWinUsbApi.dll

2018/8/1 更新
使用夜神模拟器进行测试。
安装完夜神模拟器后,使用夜神多开器,模拟安装5.1版。
把模拟器调为手机版,并且打开 开发者模式,然后重启
在安装目录下的,nox/bin/ , 有 adb 和 nox_adb。
常用的adb命令:
       查看设备是否连接到,使用 adb devices
       进入设备shell,使用 adb shell
       启动adb服务,使用adb start-server
       关闭adb服务,adb kill-server

frida-server安装与使用
注意:
1. frida-server的版本应该与客户端一致
2. 模拟器应该使用 Android-x86的版本
3. xz -d 就可以解压完成


frida-tools安装与使用
1. 在windows下的安装参考 Android HOOK 技术之Frida的初级使用
    或者直接在这个链接下载 https://pypi.org/project/frida/

2. pip进行frida以及工具的安装
 
    pip install frida
    pip install frida-tools
 
     更新frida,可以用 pip install --upgrade xxx 处理

  可以用 pip install frida==10.23.2,去安装指定的旧版本
  新版本的变化很多,很多就版本的函数都兼容不了

  调试代码的工具,可以使用IPyhon
  安装Ipython,pip install IPython

3. 使用 frida-ps -R 前进行端口转发
adb forward tcp:27042 tcp:27042
adb forward tcp:27043 tcp:27043

0x02 frida hook
frida 可以对内存里面应用的函数进行直接的操作,来修改返回值



frida参考链接
Android HOOK 技术之Frida的初级使用
Android逆向之hook框架frida篇
利用FRIDA攻击Android应用程序(一)

Brida参考链接
联合Frida和BurpSuite的强大扩展--Brida
Brida:使用Frida进行移动应用渗透测试
Brida官方教程:讲解的很详细
安卓记得关闭selinux
夜神安卓模拟器adb命令详解
故障排除:unable to communicate with remote frida-server





2017年9月6日星期三

wheezy(debian 7.5)编译安装Snort 2.9.9

Snort 2.99版的官方介绍


先把基本的依赖库安装好
apt-get install -y gcc zlib1g-dev openssl libssl-dev libdumbnet-dev bison flex libdnet
wget http://www.tcpdump.org/release/libpcap-1.8.1.tar.gz
tar xvf libpcap-1.8.1.tar.gz 
cd libpcap-1.8.1/
./configure
make && make install

pcre使用8.4版的,去官网下载并且编译安装
wget https://ftp.pcre.org/pub/pcre/pcre-8.40.tar.gz
tar xvf pcre-8.40.tar.gz 
cd pcre-8.40/
./configure
make && make install

daq直接使用snort官方下载页面上推荐与2.9.9搭配的版本即可
tar xvf daq-2.0.6.tar.gz 
cd daq-2.0.6/
./configure
autoreconf -ivf
make && make install

在Snort 2.9.9的介绍页面中,nghttp2需要被使用,如果你用1.25的版本在wheezy可能装不了,那就用1.19的版本
wget https://github.com/nghttp2/nghttp2/releases/download/v1.19.0/nghttp2-1.19.0.tar.gz
tar xvf nghttp2-1.19.0.tar.gz 
cd nghttp2-1.19.0/
./configure 
make && make install
ldconfig

最后安装snort,这一部可编译的选项比较多,可以自己看一下configure文件帮助
tar xvf snort-2.9.9.0.tar.gz
cd snort-2.9.9.0/
./configure --enable-sourcefire 
autoreconf -ivf
make
make install


启动Snort,运行正常
[root@debian ~]# snort
Running in packet dump mode

        --== Initializing Snort ==--
Initializing Output Plugins!
pcap DAQ configured to passive.
Acquiring network traffic from "eth0".
Decoding Ethernet

        --== Initialization Complete ==--

   ,,_     -*> Snort! <*-
  o"  )~   Version 2.9.9.0 GRE (Build 56) 
   ''''    By Martin Roesch & The Snort Team: http://www.snort.org/contact#team
           Copyright (C) 2014-2016 Cisco and/or its affiliates. All rights reserved.
           Copyright (C) 1998-2013 Sourcefire, Inc., et al.
           Using libpcap version 1.8.1
           Using PCRE version: 8.30 2012-02-04
           Using ZLIB version: 1.2.7

Commencing packet processing (pid=18702)
WARNING: No preprocessors configured for policy 0.
07/13-02:06:08.985161 172.16.11.196:22 -> 172.16.11.198:49388
TCP TTL:64 TOS:0x10 ID:35782 IpLen:20 DgmLen:108 DF
***AP*** Seq: 0x4F4E4F4  Ack: 0x35E422BA  Win: 0x677  TcpLen: 20
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+

在安装目录下,直接运行
make uninstall
make clean

如果是编译过程出错,要重新编译
make clean
然后再
./configure
make && make install


参考链接:
           1. ubuntu下snort的安装
           2. How to Install Snort on Ubuntu 16