C语言——指针
C语言——指针
1. 指针
首先看一个指针的基本示例
1234567891011121314151617181920212223242526272829#include <stdio.h>int main() { char a = 'F'; int f = 123; char *pa = &a; int *pb = &f; printf("a = %c\n", *pa); printf("f = %d\n", *pb); // 间接访问变量并修改值 *pa = 'C'; *pb += 2; printf("a = %c\n", *pa); printf("f = %d\n", *pb); // 查看地址长度 printf("size of pa is %d\n", sizeof(pa)); printf("size of pb is %d\n", sizeof(pb)); / ...
计算机网络(一)
计算机网络(一)
第1章 计算机网络和因特网
1. 什么是因特网
1.1 具体构成描述
因特网是一个世界范围的计算机网络,将端系统通过通信链路和分组交换机连接到一起,接入因特网并通过特定的协议传输数据。
我们使用的接入网络的设备称为主机(host)或端系统(end system)。
端系统通过 通信链路(communication link) 和 分组交换机(packet switch) 连接到一起。
端系统通过 因特网服务提供商(Internet Service Provider, ISP) 接入因特网。
每个ISP是由一个多台分组交换机和多段通信链路组成的网络。因特网就是将端系统彼此互联,因此为端系统提供接入的ISP也必须互联。较低层的ISP通过国家的、国际的较高层ISP(如 Level 3 Communications、AT&T、Sprint和NTT)互联起来。较高层ISP是由通过高速光纤链路互联的高速路由器组成的。无论是较高一层还是较低层的ISP网络,它们每个都是独立管理的,运行着IP协议,遵从一定的命名和地址规则。
端系统、分组交换机和其他因特网部件都要运行一系列 ...
计组复习
计组复习
第一章 计算机系统概论
记录一些概念性的内容,理解性的和计算的部分要落在纸上、多练
果然时间紧张,没记完。。。
1. 软硬件
计算机系统由“硬件”和“软件”两大部分组成。
硬件
计算机的实体部分
软件
看不见摸不着,友人们实现编制的具有各类特殊功能的程序组成
系统软件(系统程序)
主要用来管理整个计算机系统,监视服务,使系统资源得到合理的调度,高效运行
包括:标准数据库,语言处理程序,操作系统,数据库管理系统,网络软件等
应用软件
用户更具任务需要所编制的各种程序
如:科学计算程序,数据处理程序,过程控制程序,事物管理程序
2. 计算机系统的层次结构
层次
作用
类型
虚拟机器 M4(高级语言机器)
用编译程序翻译成汇编语言程序
虚拟机
虚拟机器 M3(汇编语言机器)
用汇编程序翻译成机器语言程序
虚拟机
虚拟机器 M2(操作系统机器)
用机器语言解释操作系统
虚拟机
传统机器 M1(机器语言机器)
用为程序解释机器指令
实体机
微程序机器 M0(微指令系统)
由硬件直接执行微指令
实体机
翻译程序: 将高级语言程序翻译 ...
人工智能(四)
人工智能复习(四)
四、搜索策略
1. 搜索的基本概念
2. 状态空间的搜索
2.1 盲目搜索
广度优先
深度优先
代价一致
关于上述几种搜索,在另一篇文章中有对比说明:https://www.awellfrog.cc/p/401ea1e.html
2.2 代价树搜索
代价树的深度优先搜索
从open表中选择刚扩展的子节点中代价最小的节点
代价树的广度优先搜索
从open表中选择全体节点中代价最小的节点
2.3 启发式搜索(重点)
A算法
在图搜索算法中,如果能在搜索的每一步都利用估价函数f(n)=g(n)+h(n)对Open表中的节点进行排序,则该搜索算法为A算法。由于估价函数中带有问题自身的启发性信息,因此,A算法又称为启发式搜索算法(英文:heuristic search)。
对启发式搜索算法,又可根据搜索过程中选择扩展节点的范围,将其分为全局择优搜索算法和局部择优搜索算法。
全局择优搜索中,每当需要扩展节点时,总是从Open表的所有节点中选择一个估价函数值最小的节点进行扩展。
局部择优搜索中,每当需要扩展节点时,总是从刚生成的子节点中选择一个估价函数值最小的节 ...
解决“Please make sure you have the correct access rights and the repository exists."
解决“Please make sure you have the correct access rights and the repository exists."
push 博客的时候时不时就会遇到这样的问题,更新一下密钥就好了,记录一下方便以后使用
1. 删除原先的rsa文件
找到 .ssh 文件夹,删除里面的内容
2. 重置用户和邮箱
在 .ssh 文件夹中右键打开 git Bash
12345git config --global user.name ‘Awellfrog’git config --global user.email ‘[email protected]’# 查看命令git config --list
3. 生成新的密钥
1ssh-keygen -t rsa -C "[email protected]"
一路回车
看到奇怪的图案就生成了
用记事本打开 id_rsa.pub
将其中的公钥复制到 github 仓库的公钥中
4. 连接测试
1ssh -T [email protected]
输入上面命令,应该就正常了,如果 ...
SQL Injection (Blind)
SQL Injection (Blind)(SQL 盲注)
盲注部分的源码与 SQL Injection 一致,只不过将查询内容不是直接返回,变成了只返回是否存在。就要通过这一特性来设置 payload 猜测要注入的部分。
Low
Boolean盲注
获取数据库名
首先获取长度 1' and length(database())>3#
长度大于3
再输入 1' and length(database())>4#
长度小于等于4
所以用户名长度为 4
利用 ASCII 码猜测数据库的名称
首先猜测第一个字母 1' and substr(database(),1,1)='a'#
可以看到不是 a
再试 1' and substr(database(),1,1)='d'#
第一个字母是 d
同理猜测其他的字母,第二个字母是 1' and substr(database(),2,1)='v'#
其余的类似,不再赘述。 实际上做时,要写脚本或使用sqlmap,不然工作量太大,写脚本也不会按照ASCII表去一个个的尝试,可以先判断字符是不是字母,使用二分查找 ...
SQL Injection
SQL Injection(SQL 注入攻击)
套路
注入思路:
是否有注入?是字符型还是数字型
获取当前数据库
获取库名
获取表名
获取列名
下载(显示数据)
LOW
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556<?phpif( isset( $_REQUEST[ 'Submit' ] ) ) { // Get input $id = $_REQUEST[ 'id' ]; switch ($_DVWA['SQLI_DB']) { case MYSQL: // Check database $query = "SELECT first_name, last_name FROM users WHERE user_id = '$id ...
Brute Force
Brute Force(暴力破解)
Low
首先看一下源码,提取出关键部分:
1234567891011<?php --- // Check the database $query = "SELECT * FROM `users` WHERE user = '$user' AND password = '$pass';"; $result = mysqli_query($GLOBALS["___mysqli_ston"], $query ) or die( '<pre>' . ((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)) . '< ...
搜索算法
搜索算法
被可爱的女孩子问懵了,学艺不精,翻车的我决定重新理解一下这几个算法
wiki真是个好东西,它真的我哭死
1. 深度优先搜索(Depth-First-Search, DFS)
不多说,遍历顺序如下图序号
2. 广度优先搜索(Breadth-first search, BFS)
也不多说,遍历顺序在图中
3. 启发式搜索策略
3.1 爬山法(Hill climbing)
爬山法是完完全全的贪心法,每次都鼠目寸光的选择一个当前最优解,因此只能搜索到局部的最优值。
例题: 以八数码为例
每一步都选择局部最优,最后很可能陷入一个局部最优解。
那么能不能优化一下呢?当它找到某个山顶时,可以给个随机数,随机一下,就有概率找到更优的解(同时也承担着找到更差解的风险)。下面以模拟退火为例,
模拟退火其实也是一种贪心算法,但是它的搜索过程引入了随机因素.。模拟退火算法以一定的概率来接受一个比当前解要差的解,因此有可能会跳出这个局部的最优解,达到全局的最优解。以上图为例,模拟退火算法在搜索到局部最优解A后,会以一定的概率接受到E的移动。也许经过几次这样的不是局部最优 ...
人工智能(三)
人工智能复习(三)
三、推理
3. 不确定性推理
3.2 概率推理(Bayes 是重点)
3.2.1 概率的基础介绍
理解随机变量
联合概率,边缘概率,条件概率的意义及计算方法
链式法则及贝叶斯法则
3.2.2 贝叶斯网络的表示(重点)
贝叶斯网络的表示方法,其中任意两个节点间相互独立性的判断方法
贝叶斯网(Bayesian network)亦 称 “信念网”(belief network),它借助有向无环图(Directed Acyclic Graph ,简 称 DAG)来刻画属性之间的依赖关系,并使用条件概率表(Conditional Probability Table ,简 称 CPT )来描述属性的联合概率分布。
贝叶斯网结构有效地表达了属性间的条件独立性。
贝叶斯网络中的三种典型关系:
同父结构:x1x_1x1 确定时,x3,x4x_3,x_4x3,x4 条件独立
V 型结构:x4x_4x4 不确定时,x1,x3x_1,x_3x1,x3 条件独立
顺序结构:xxx 确定时,y,zy, zy,z 条件独立
判断条件独立时,有两种方法:
D分离( ...