安全矩阵

 找回密码
 立即注册
搜索
楼主: oldmoon

胡逸芳的学习日记

[复制链接]

30

主题

60

帖子

447

积分

中级会员

Rank: 3Rank: 3

积分
447
 楼主| 发表于 2020-7-27 16:33:48 | 显示全部楼层
SQLServer 存储过程  ----  01 初识
200726

基本认识
1.什么是存储过程?
  存储过程(Stored Procedure)是在大型数据库系统中,一组为了完成特定功能的SQL 语句集。它存储在数据库中,一次编译后永久有效,用户通过指定存储过程的名字并给出参数(如果该存储过程带有参数)来执行它。存储过程是数据库中的一个重要对象。在数据量特别庞大的情况下利用存储过程能达到倍速的效率提升。
  简言之,我认为可以将存储过程看作一个动作集合,与函数相比,它不返回具体值或结果,但可在函数(SQL查询)中调用,达到迅速做出特定动作的目的。
2.个人感觉,存储过程的实现和C很相像,不过是语法上的区别,需要使用SQL语句进行编写罢了。为后续写注入脚本会有帮助。

基本语法
1.声明

  1. declare  @a  int
  2. -- @变量名,后加变量类型,必须为SQL数据库的标准类型如 int();char(20);nvarchar(200)
复制代码
2.赋值
  1. set  @a=100
复制代码

3.条件判断语句
(1)if
  1. if  @a>=10
  2. begin
  3.    ......
  4.    ......
  5. end
复制代码
(2)while
  1. while  @a<=100
  2. begin
  3.    ......
  4.    ......
  5. end
复制代码
(3)when  ......  then  ......
  1. when  @b>=1  then  1
  2. (语法对错待查询)
复制代码
4.建立存储过程
  1. create proc sp_name  @[参数名] [类型],@[参数名] [类型]
  2. as
  3. begin
  4.    ......
  5.    ......
  6. end
  7. /*其中“sp_name”为需要创建的存储过程的名字,该名字不可以以阿拉伯数字开头*/
复制代码


百钱买百鸡问题
出自《张邱建算经》原书卷下第38题。
原文:
今有鸡翁一,值钱伍;鸡母一,值钱三;鸡鶵三,值钱一。凡百钱买鸡百只,问鸡翁、母、鶵各几何?
答曰:鸡翁四,值钱二十;鸡母十八,值钱五十四;鸡鶵七十八,值钱二十六。又答:鸡翁八,值钱四十;鸡 母十一,值钱三十三,鸡鶵八十一,值钱二十七。又答:鸡翁十二,值钱六十;鸡母四、值钱十二;鸡鶵八十 四,值钱二十八。
释义:
5文钱可以买一只公鸡,3文钱可以买一只母鸡,1文钱可以买3只雏鸡。现在用100文钱买100只鸡,那么各有公鸡、母鸡、雏鸡多少只?
求解:
设公鸡、母鸡、小鸡分别为x、y、z 只,由题意得:
x+y+z =100
5x+3y+(1/3)z =100
解得:x1 =0 , y1 =25 , z1 =75 ; x2 =4,y2 =18,z2 =78 ; x3 =8;y3 =11;z3 =81 ; x4 =12;y4 =4;z4 =84 。

C语言实现:
  1. /*  百钱买百鸡问题:buyji.c  */
  2. #include <stdio.h>
  3. void main()
  4. {
  5.    int cocks=0,hens,chicks;
  6.    while(cocks<=20)
  7.      {
  8.        hens=0;
  9.        while(hens<=33)
  10.          {
  11.            chicks=100-cocks-hens;
  12.            if(5.0*cocks+3.0*hens+chicks/3.0==100.0)
  13.            printf("公鸡%d只,母鸡%d只,小鸡%d只\n",cocks,hens,chicks);
  14.            hens++;
  15.          }
  16.        cocks++;
  17.      }
  18. }
复制代码
SQLSEerver 存储过程实现:
  1. create procedure buyji @cock int,@hen int,@chicken int
  2. --cock:公鸡  hen:母鸡  chicken:小鸡
  3. as
  4. begin
  5. print '百钱买鸡问题可能解有:'
  6. set @cock=0
  7. set @hen=0
  8. set @chicken=0
  9. while @cock<=20
  10. begin
  11.    while @hen<=33
  12.    begin
  13.    set @chicken=100-@cock-@hen
  14.    if 5.0*@cock+3.0*@hen+@chicken/3.0=100.0
  15.      begin
  16.      print '公鸡有'+@cock+'只,母鸡有'+@hen+'只,小鸡有'+@chicken+'只。'
  17.      set @hen=@hen+1
  18.      end
  19.    set @cock=@cock+1
  20.    end
  21. end
  22. end
复制代码




回复

使用道具 举报

30

主题

60

帖子

447

积分

中级会员

Rank: 3Rank: 3

积分
447
 楼主| 发表于 2020-7-31 11:14:23 | 显示全部楼层
Python绝技:运用Python成为顶级黑客
200730、200731   第1章  入门
书中使用的代码为Python 2.6.5版本,与Python3有部分语法不通,会产生报错。由于我使用的是Python 3.6.6版本,故在之后的学习笔记中我会将报错的部分改为python3适用的亚子,同时在有修改的部分会用三个连续井号(###)以示标注。

0X01 基础知识变量
python是一种解释型语言,解释器会在运行时处理并执行代码。
当我们声明变量时,python会自动为变量保留内存空间,python解释器可以决定变量的类型和为变量保留多少内存空间。
  1. >>> port=21                             # An insteger
  2. >>> type(port)
  3. <class 'int'>
  4. >>> banner="FreeFloat FTP Server"       # A string
  5. >>> type(banner)
  6. <class 'str'>
  7. >>> portlist=[21,22,80,8080,8081]       # A list
  8. >>> type(portlist)
  9. <class 'list'>
  10. >>> portOpen=True                       # A boolean
  11. >>> type(portOpen)
  12. <class 'bool'>
  13. >>> print "[+]Checking for "+banner+"on port "+str(port)
  14. SyntaxError: invalid syntax
  15. >>> print("[+]Checking for "+banner+"on port "+str(port))
  16. [+]Checking for FreeFloat FTP Serveron port 21      ###
复制代码

字符串
字符串的处理:
upper()  将字符串转换成大写
lower()   将字符串转换成小写
repalce(old,new)   用new子串取代old字串
find()   返回子串在字符串中第一次出现时的偏移量
  1. >>> banner="freefloat ftp server"
  2. >>> print(banner.upper())             #upper()
  3. FREEFLOAT FTP SERVER
  4. >>> print(banner)
  5. freefloat ftp server
  6. >>> BANNER="FREEFLOAT FTP SERVER"
  7. >>> print(BANNER.lower())             #lower()
  8. freefloat ftp server
  9. >>> print(BANNER)
  10. FREEFLOAT FTP SERVER
  11. >>> print(banner.replace('freefloat','oldmoon'))            #replace()
  12. oldmoon ftp server
  13. >>> print(banner.find('ftp'))         #find()  ?存疑
  14. 10
  15. >>> print(banner.find('f'))
  16. 0
  17. >>> print(banner.find('t'))
  18. 8
  19. >>> print(banner.find('p'))
  20. 12
复制代码

列表(List)
Python中的list数据结构是在python种存储对象数组的极好方式,如下例,通过调用append()方法向其中添加元素,正式创建list之后可对元素进行排序(sort())和打印,也可指定某元素的索引(index())同时可删除指定的元素(remove())。
  1. >>> portlist=[]               
  2. >>> portlist.append(21)          # append() 添加元素
  3. >>> portlist.append(22)
  4. >>> portlist.append(80)
  5. >>> portlist.append(8080)
  6. >>> portlist.append(443)
  7. >>> print(portlist)
  8. [21, 22, 80, 8080, 443]
  9. >>> print(portlist.sort())       #sort() 排序
  10. None
  11. >>> portlist.sort()
  12. >>> print(portlist)
  13. [21, 22, 80, 443, 8080]
  14. >>> pos=portlist.index(443)      #index() 索引
  15. >>> print(str(pos))
  16. 3
  17. >>> portlist.remove(80)          #remove() 删除元素
  18. >>> print(portlist)
  19. [21, 22, 443, 8080]
  20. >>> num=len(portlist)            #len() 计数
  21. >>> print(str(num))
  22. 4
复制代码

词典
词典由n对键(key)和值的项(item)组成。
创建词典时,每个键和他的值以冒号分隔(key:item)
应用:创建一个词典,在查找关键字时,可返回相应的键值,达到快速查询的目的。
  1. >>> service={'ftp':21,'ssh':22,'smtp':25,'http':80}                     
  2. >>> service.keys()   #返回键(key)                       
  3. dict_keys(['ftp', 'ssh', 'smtp', 'http'])
  4. >>> service.items()   #返回所有   
  5. dict_items([('ftp', 21), ('ssh', 22), ('smtp', 25), ('http', 80)])
  6. >>> service['ssh']   #返回键对应的值(可用于查询)
  7. 22
  8. >>> service.has_key('ftp')   ###
  9. Traceback (most recent call last):
  10.   File "<pyshell#43>", line 1, in <module>
  11.     service.has_key('ftp')
  12. AttributeError: 'dict' object has no attribute 'has_key'
  13. >>> 'ftp' in service   #判断是否有此键值
  14. True
复制代码

网络
socket模块提供一个用Python进行网络连接的库。
下示抓取banner脚本:连接上指定的IP和TCP端口,并将banner打印出来。
  1. >>> import socket   #加载socket模块
  2. >>> socket.setdefaulttimeout(2)   #设置超时时长
  3. >>> s=socket.socket()   #实例化socket类新变量 (?)
  4. >>> s.connect("192.168.22.119",21)   #连接connect("ip",port)
  5. >>>ans=s.recv(1024)   #从套接字中取出1024B数据
  6. >>>print ans
复制代码

条件选择语句
下示抓取banner脚本:将服务器响应结果与一些已知漏洞的FTP服务器版本的banner进行比较。这样就能够知道某个特定的服务器中是否存在可以攻击的漏洞。
  1. if ("freefloat ftp server (version 1.00)" in ans):
  2.         print("[+]111freefloat ftp is vulnerable.")
  3. elif("3com 3cdaemon ftp server (version 2.00)" in ans):
  4.         print("[+]222freefloat ftp is vulnerzble")
  5. else:
  6.         print("[-]ftp server is not vulnerable")
复制代码

(抄书有点蠢,直接上修改好后的完善脚本,下示模块略,详情见书)
异常处理
try/expect()
函数
定义函数 def()
函数从主函数main()开始,定义函数内对变量的任何更改都会影响它们在主调函数中的值。
迭代
for()
文件输入/输出
cat()
open(“file”,‘r’)   #只读模式
sys模块
os模块


回复

使用道具 举报

30

主题

60

帖子

447

积分

中级会员

Rank: 3Rank: 3

积分
447
 楼主| 发表于 2020-8-5 17:35:08 | 显示全部楼层
本帖最后由 oldmoon 于 2020-8-7 11:00 编辑

200805
1.看文章:
机缘巧合之下拿下个发卡网还撸了把羊毛

Windows用户密码的加密与破解利用

实战|记一次授权的渗透测试

2.在google 6p上尝试直接命令行写入并运行python程序(python绝技第一章第一个ftp漏洞扫描程序)
3.python绝技,一个程序:unix口令破解机
4.web第五章看完,照着书敲了一边,尚未搭环境复现


收获:
1.kali虚拟机出现如下问题,莫得ip地址
  1. <font size="4" face="宋体">root@kali:~# ifconfig
  2. lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
  3.         inet 127.0.0.1  netmask 255.0.0.0
  4.         inet6 ::1  prefixlen 128  scopeid 0x10<host>
  5.         loop  txqueuelen 1000  (Local Loopback)
  6.         RX packets 4749  bytes 287841 (287.8 KB)
  7.         RX errors 0  dropped 0  overruns 0  frame 0
  8.         TX packets 4749  bytes 287841 (287.8 KB)
  9.         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0</font>
复制代码
解决方法:
若不是root权限则线切换到root权限
  1. <font size="4" face="宋体">test@kali~#sudo -i
  2. 输入root密码
  3. </font>
复制代码
输入dhclient -v
  1. <font size="4" face="宋体">root@kali:~# dhclient -v
  2. Internet Systems Consortium DHCP Client 4.3.5
  3. Copyright 2004-2016 Internet Systems Consortium.
  4. All rights reserved.
  5. For info, please visit https://www.isc.org/software/dhcp/

  6. Listening on LPF/ens0/00:0c:29:16:38:59
  7. Sending on   LPF/ens0/00:0c:29:16:38:59
  8. Sending on   Socket/fallback
  9. DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 6
  10. DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 12
  11. DHCPOFFER of 192.168.xx.xxx from 192.168.xx.1
  12. DHCPREQUEST of 192.168.xx.xxx on eth0 to 255.255.255.255 port 67
  13. DHCPREQUEST of 192.168.xx.xxx on eth0 to 255.255.255.255 port 67
  14. DHCPACK of 192.168.xx.xxx from 192.168.xx.1
  15. bound to 192.168.xx.xxx -- renewal in 705 seconds.
  16. </font>
复制代码
再次输入ifcnfig可发现ip正常出现,可正常上网
  1. <font size="4" face="宋体">root@kali:~# ifconfig
  2. eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
  3.         inet 192.168.xx.xxx  netmask 255.255.255.224  broadcast 192.168.xx.255
  4.         inet6 fe80:20c:29ff:fe16:3859  prefixlen 64  scopeid 0x0<global>
  5. ether 00:0c:29:16:38:59  txqueuelen 1000  (Ethernet)
  6.         RX packets 8  bytes 1251 (1.2 KB)
  7.         RX errors 0  dropped 0  overruns 0  frame 0
  8.         TX packets 27476  bytes 8642 (1.8MiB)
  9.         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
  10. device interrupt 19 base 0x2000

  11. lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
  12.         inet 127.0.0.1  netmask 255.0.0.0
  13.         inet6 ::1  prefixlen 128  scopeid 0x10<host>
  14.         loop  txqueuelen 1000  (Local Loopback)
  15.         RX packets 4942  bytes 299699 (299.6 KB)
  16.         RX errors 0  dropped 0  overruns 0  frame 0
  17.         TX packets 4942  bytes 299699 (299.6 KB)
  18.         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0</font>
复制代码
2.Windows用户密码的加密与破解利用
(1)Windows系统中本机用户的密码Hash放在本地的SAM文件中,域内用户的密码Hash存在域控的NTDS.DIT文件中。
LM
LM Hash简介
LAN Manager(LM)哈希是Windows系统所用的第一种密码哈希算法,是一种较古老的Hash,在LAN Manager协议中使用,非常容易通过暴力破解获取明文凭据。它只有唯一一个版本且一直用到了NT LAN Manager(NTLM)哈希的出现,在Windows Vista/Windows 7/Windows Server 2008以及后面的系统中,LM哈希算法是默认关闭的,LM算法是在DES基础上实现的,不区分字母大小写。
LM Hash生成原理
  1.用户的密码转换为大写,密码转换为16进制字符串,不足14字节将会用0来再后面补全。
  2.密码的16进制字符串被分成两个7byte部分。每部分转换成比特流,并且长度位56bit,长度不足使用0在左边补齐长度
  3.再分7bit为一组,每组末尾加0,再组成一组
  4.上步骤得到的二组,分别作为key 为 KGS!@# $%进行DES加密。
  5.将加密后的两组拼接在一起,得到最终LM HASH值。
LM Hash缺点
  1.密码长度最大只能为14个字符
  2.密码不区分大小写
  3.如果密码强度是小于7位,那么第二个分组加密后的结果肯定是aad3b435b51404ee
  4.Des密码强度不高
NTLM
NTLM Hash简介
NT LAN Manager(NTLM)哈希是Windows系统认可的另一种算法,用于替代古老的LM-Hash,一般指Windows系统下Security Account Manager(SAM)中保存的用户密码hash,在Windows Vista/Windows 7/Windows Server 2008以及后面的系统中,NTLM哈希算法是默认启用的。
NTLM Hash生成原理
  1.先将用户密码转换为十六进制格式。
  2.将十六进制格式的密码进行Unicode编码。
  3.使用MD4摘要算法对Unicode编码数据进行Hash计算
  1. python2 -c 'import hashlib,binascii; print binascii.hexlify(hashlib.new("md4", "P@ssw0rd".encode("utf-16le")).digest())'


  2. e19ccf75ee54e06b06a5907af13cef42
复制代码
(2)攻击方法
mimikatz
powershell
ProcDump+mimikatz
......
文章很好,原文地址:https://mp.weixin.qq.com/s?__biz=MzI0NzEwOTM0MA==&mid=2652478728&idx=1&sn=272a288b100c74c452c49c9a81a74984&chksm=f2583ebbc52fb7ada23bcde4b0ff768d918d5d3338dd26ba3c952e9ed55c7040f2cd59c57107&mpshare=1&scene=23&srcid=0805EZJAZ9AMmhmC5iiTMo5p&sharer_sharetime=1596611343835&sharer_shareid=ff83fe2fe7db7fcd8a1fcbc183d841c4#rd

nc命令习解:https://www.sqlsec.com/2019/10/nc.html



回复

使用道具 举报

30

主题

60

帖子

447

积分

中级会员

Rank: 3Rank: 3

积分
447
 楼主| 发表于 2020-8-9 09:27:06 | 显示全部楼层
本帖最后由 oldmoon 于 2020-8-10 10:22 编辑

200808-200809
1.安装/更新Nessus
2.安装Xray
3.使用自动化漏洞挖掘工具Fofa2-xray
4.SqlServer利用差异备份写入webshell
5.熟悉shodan、fofa、zoomeye语法
6.!!绕过文件上传处戒备森严的宝塔系统!!新思路



1.Nessus安装踩坑小记
(1)前往官网下载最新版本的安装包,现以windows 10 64biit 安装为例
官网地址:https://www.tenable.com/downloads/nessus?loginAttempted=true
(2)双击安装包,按默认流程走一遍
(3)弹出web页时,需注意以下两点:


其余按默认点击next即可。
登录后可见如下页面,左上角只有一个setting选项,接下来进行破解流程。

(4)在任务管理器中关闭nessus服务

(5)将 plugin_feed_info.inc 文件分别放入如下两个文件夹中,替换原有文件
注:路径 C:\ProgramData\ 需要在搜索栏中手动输入才能找见


(6)将 文件放入 C:\Program Files\Tenable\Nessus 文件夹中

(7)cmd以管理员形式运行,输入:
  1. C:\Users\iamla > cd  C:\Program Files\Tenable\Nessus

  2. C:\Program Files\Tenable\Nessus > nessuscli update all-2.0.tar.gz
复制代码


(8)在任务管理器中重新开启Nessus服务

(10)浏览器打开 https://127.0.0.1:8834 ,耐心等待更新后登录,看到左上角出现 Scans 栏即表示破解成功


2.安装xray:
官方下载地址:https://github.com/chaitin/xray/releases
使用指南:https://docs.xray.cool/#/tutorial/introduce

3.自动化漏洞挖掘程序踩坑小记:

6.!!绕过文件上传处戒备森严的宝塔系统!!新思路


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

30

主题

60

帖子

447

积分

中级会员

Rank: 3Rank: 3

积分
447
 楼主| 发表于 2020-8-23 12:46:51 | 显示全部楼层
本帖最后由 oldmoon 于 2020-8-23 12:48 编辑

200823  tip小记

kali更新换源:
  1. <font size="4" face="宋体">//查看时间,若不是最新时间则进行修改
  2. #date
  3. #date -s 20200823
  4. #date -s 10:00:00
  5. //保存配置
  6. #hwclock --systohc
  7. //换源
  8. #vim /etc/apt/sources.list
  9. 输入 i 进入修改模式
  10. //中科大
  11. deb http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib
  12. deb-src http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib
  13. //阿里云
  14. deb http://mirrors.aliyun.com/kali kali-rolling main non-free contrib
  15. deb-src http://mirrors.aliyun.com/kali kali-rolling main non-free contrib
  16. //清华大学
  17. deb http://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main contrib non-free
  18. deb-src https://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main contrib non-free
  19. 输入 :wq! 强制修改文件内容
  20. //更新
  21. #apt-get update
  22. #apt-get upgrade
  23. #apt-get clean
  24. //清理不用的安装包
  25. #apt autoremove
  26. over
复制代码


安装docker:
  1. //更新
  2. #apt-get update
  3. //安装https协议、CA证书
  4. #apt-get install -y apt-transport-https ca-certificates
  5. //安装docker
  6. #apt install docker.io
  7. //等待完成后查看是否安装成功
  8. #docker -v
  9. //启动docker
  10. #systemctl start docker
  11. //显示docker信息
  12. #docker ps -a
  13. //安装pip
  14. #apt-get install python3-pip
  15. //安装docker-compose
  16. #pip install docker-compose
  17. //查看docker-compose版本
  18. #docker-compose -v
  19. //over
  20. //安装 vulhub(可选)
  21. #git clone https://github.com/vulhub/vulhub.git
  22. //安装vulfocus啥的
  23. ......
复制代码
参考文章:https://mp.weixin.qq.com/s?__biz=MzUyOTg5NDQ3MA==&mid=2247484139&idx=1&sn=2149579b871512e4d14033330140e6a2&chksm=fa5b5fc2cd2cd6d46ac4f5852444db1baeed4563520799bcf1e6a79d46ce45164f876be41211&mpshare=1&scene=23&srcid=0822C3OFbtj7hhMT877gy0aw&sharer_sharetime=1598071780102&sharer_shareid=ff83fe2fe7db7fcd8a1fcbc183d841c4#rd





回复

使用道具 举报

30

主题

60

帖子

447

积分

中级会员

Rank: 3Rank: 3

积分
447
 楼主| 发表于 2020-9-22 23:35:57 | 显示全部楼层
200922
Notes:
1.Review the first section of the first chapter of higher algebra.
2.Memorize the first and second parts of the English words.






本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

30

主题

60

帖子

447

积分

中级会员

Rank: 3Rank: 3

积分
447
 楼主| 发表于 2020-9-24 07:21:10 | 显示全部楼层
200923  supplement of yesterday's note
1.Reviewed the second section of the first chapter of higher algebra.
2.Recited the third section of English words.
3.Make a preliminary attempt to browse and translate the contents of Kali's official website(some of the notes are given below).




本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

30

主题

60

帖子

447

积分

中级会员

Rank: 3Rank: 3

积分
447
 楼主| 发表于 2020-9-26 00:02:01 | 显示全部楼层
本帖最后由 oldmoon 于 2020-9-26 09:36 编辑

200925Notes:
1.Reviewed the third section of the first chapter of the higher algerbra.
2.Recited the forth section of English words.
3.Browsing the content of Net Hunter on kali's office website and found that the words used in the description of the product and the summary of the product features were very interesting.
4.Start reading in simple english,like fairy tales and short novels.







Plans of the rare leisure Saturday.
1.Six to ten episodes of the PHP100 series.
2.Take some time to review the notes from the past while reading technical articles.
3.Rearrange the idea of software copyright's materials and composition.(important)

Some insights and experiences from my recent studying life.The most intuitive felling is the fatigue between the two majors.The fact that I must admit is that I am a mediocre person.After the conversation I realized that the only thing I could do now and for a year to come is to do my limit part of the job without being interrupted by the others.YuzuruHanyu said that it was precisely because I was so weak that I could not be completely immune to outside influences.The end,I think my major should not be a burden to me,it should be my unique strength,although it may sounds far away,I am still looking forward to it.

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

30

主题

60

帖子

447

积分

中级会员

Rank: 3Rank: 3

积分
447
 楼主| 发表于 2020-10-6 11:04:54 | 显示全部楼层
201006
Note summary:

1.In the video tutorial of ThinkPHP framework,the distinction between methods and  classes is not obvious,so there is confusion. For the difference between classes and methods and their usage scenarios,refer to the following articles:https://www.jianshu.com/p/35133302e485
2.It's not easy to add C# framework in the VS.A tutorital is needed for the installation  progress.
3.This semester opened a single-clip microcomputer and programming courses,so I look back at the winter vacation of C language assembly content and have a new understanding of memory and stack,including variabes come into and out of the stack and so on.My professional teacher says the goal of the course is to write embedded programs,so I fell it can also help to having better understanding of my courses.

It often takes an entire afternoon or evening to solve (and sometimes not necessarity) a small piece of code that reports an error.I don't know whether it;s my low efficiency or it's really a work that needs slow and meticoulous work.Maybe both are.



回复

使用道具 举报

30

主题

60

帖子

447

积分

中级会员

Rank: 3Rank: 3

积分
447
 楼主| 发表于 2020-11-14 22:14:55 | 显示全部楼层
《基于数据科学的恶意软件分析》P1-5章
  记得刚接触恶意软件分析一词是在看《黑客免杀攻防》第一二章时,对杀毒软件基于行为查杀和基于特征查杀的区别刚有概念那会。这本书断断续续看到第五章了,从刚开始不知所云到隐约感到有循序渐进的逻辑的现在,知与常规web渗透一样有相对固定的思路。
(1)从静态分析开始,了解PE文件格式、使用pefile解析PE文件格式,拆分出恶意代码中的图片、字符串并进行分析。进阶版静态分析使用反汇编技术,可以彻底了解恶意程序,此处需要有一些汇编基础及堆栈概念。以上这些对于完全未伪装的赤果果恶意代码是有用的,但对于Anti-Virus做出的加壳、加密、资源混淆及反汇编等操作,就显现出了巨大的局限性(啥也没有,分析了个寂寞)。
(2)此时开启第二篇章,动态分析。为了弄清混淆过程恶意代码的工作过程,使用了沙箱来模拟运行,通过观察它的动作来识别判断该动作是否为恶意行为,从而判断该样本是否为恶意代码。同时,该方法在分析的同时也收集了大量的样本,在此基础上可进一步构建基于机器学习的恶意软件检测器。动态分析的局限在于,在sandbox中若没有特定的触发条件,恶意软件样本的全部功能无法全部显现出来。
(3)此时进入第三阶段,利用恶意软件网络识别攻击活动。在恶意软件网络中,经定义,恶意软件中有相似特征或有直接联系的样本将被连接。在样本基数足够大时,可以清晰地看出样本间的联系关系及恶意软件样本“社交网络”的整体情况。在此阶段中,需要解决如何优化可视化恶意软件网络的问题,即失真问题。作者介绍了如何使用力导向算法进行优化(通过python代码实例进行说明):使用NetwirkX构建网络、添加节点和边、添加属性、将网络保存到磁盘、使用GraphViz实现网络可视化、使用参数调整网络、向节点和边添加可视属性、构建恶意软件网络、构建共享图像关系网络。在构建好恶意代码共享网络后,如何利用此共享网络对新发现的恶意软件样本进行分析?
(4)此时便进入第四阶段,共享代码的分析(相似性分析)。首先在庞大特征袋中选取恶意软件特征家族与经特征提取的样本进行比较(N-gram),再使用Jaccard系数量化相似性(即将特征吻合的百分率计算出来,是一个简单的求交集运算)。接着使用 相似性矩阵 评价恶意软件共享代码估计方法 来确定两个恶意软件样本是否来自于同一个家族,此处包括四种方法:基于指令序列的相似性、基于字符串的相似性、基于导入地址表的相似性和基于动态API调用的相似性。这四种方法各有侧重及优缺点,不进行赘述(书P66-71),总体来说基于导入地址表的相似性方法效果最好。接下来,构建相似性图对恶意软件数据集进行分析(书P71-75)。在处理大规模的恶意软件样本时,为精简样本计算量,使用 minihash 或许样本特征(原理见书P77)。对于大小为n的数据集来说,使用相似性矩阵所需的Jaccard系数计算次数为[ (n^2-n)/2],而minihash则少得多。minihash代码实现见书P79-86。

   与看过的杀毒软件的基于特征的查杀原理很相似,但是更加细致,同时引入了大数据分析的引导思路,像是开拓了一个新天地吧(虽道阻且长orz)。

  此书难度非我现在所能驾驭,稍微整理了下看过来的思路和笔者之所以这样叙述的原因,在遗忘后再复习时对脉络和逻辑能有点模糊印象,这样看书的目的应该算是达到了。

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|安全矩阵

GMT+8, 2024-3-29 00:16 , Processed in 0.019632 second(s), 17 queries .

Powered by Discuz! X4.0

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表