iOS插到Mac用终端抓包
ifconfig -l
# 查看当前能抓包的端口rvictl -s xxxxxxxxxxxxxx
# 加入手机的Device IDsudo tcpdump -i rvi0 -w ~/desktop/抓包/100.pcap
# 存放包路径
目的: 客户端发送两个整数,让服务器给我们做加法,然后再用Json格式传给客户端
1 | #coding:utf8 |
1 | import json |
1 | # coding:utf8 |
1 | from socket import * |
最近在学Python CGI编程,环境一直弄不好,Google了一大圈,看了很多博客,后面实践下来,要么就是403,要么就是解析不出来,直接打印出源码,现在在这里记录一下我自己的操作步骤,以便以后在遇到该问题好直接上手
sudo vim /etc/apache2/httpd.config
Include /private/etc/apache2/extra/httpd-vhosts.conf
AddHandler cgi-script .cgi
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
AddHandler cgi-script .cgi
后面添加要支持的cgi文件,比如.pl .py
sudo apachectl restart
sudo vim /etc/apache2/extra/httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "/Library/WebServer/Documents" #原始的目录
ServerName localhost
ErrorLog "/private/var/log/apache2/localhost-error_log"
CustomLog "/private/var/log/apache2/localhost-access_log" common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/Users/mac/Desktop/PyCharm/cgi/" #自定义目录
ServerName studycgi #自定义本地域名
ErrorLog "/private/var/log/apache2/sites-error_log"
CustomLog "/private/var/log/apache2/sites-access_log" common
<Directory "/Users/mac/Desktop/PyCharm/cgi/">
Options Indexes FollowSymLinks MultiViews ExecCGI #这里必须要有ExecCGI否则会403
AllowOverride All
Require all granted
</Directory> #这里添加权限设置,否则会出现403
</VirtualHost>
etc/apache2/users/username.conf
#这里的username是你的电脑名称 <Directory "/Users/mac/Desktop/PyCharm/cgi/">
Options Indexes FollowSymLinks MultiViews ExecCGI #这里必须要有ExecCGI否则会403
DirectoryIndex index.html index.cgi
AllowOverride None
Require all granted
Order allow,deny
Allow from all
</Directory>
sudo apachectl restart
sudo vim /etc/hosts
127.0.0.1 studycgi
http://studycgi
即可访问自定义的网站目录…………
要是你直接用官方的AutoLayout来布局的话,看看下面的代码感受一下
1 | UIView *view = UIView.new; |
创建一个UIScrollView以便测试
1 | UIScrollView *sc = [[UIScrollView alloc]init]; |
1 | - (NSArray *)randomColor{ |