
@byxiaoxie2年前
03/13
19:35
此方法仅用与[ubuntu 14.04+ debian 8 centos 7+]系统
服务器:系统平台[Debian 8 x64] 测试IP:[149.28.13*.**] 主机:系统平台[Windows 7]
先更新好软件包
apt update && apt upgrade -y
此方法仅用与[ubuntu 14.04+ debian 8 centos 7+]系统
服务器:系统平台[Debian 8 x64] 测试IP:[149.28.13*.**] 主机:系统平台[Windows 7]
先更新好软件包
apt update && apt upgrade -y
引用:using System.Net;
/// <summary>
/// 域名转IP
/// </summary>
/// <param name="domain">域名</param>
public static string getIP(string domain)
{
domain = domain.Replace("http://", "").Replace("https://", "");
IPHostEntry host = Dns.GetHostEntry(domain);
IPEndPoint ip = new IPEndPoint(host.AddressList[0], 0);
return ip.Address.ToString();
}
引用:using System.Net;
/// <summary>
/// 查IP国家/地区
/// </summary>
/// <param name="strIP"></param>
/// <returns></returns>
public static string GetIPCitys(string strIP)
{
string Url = null;
string Text = null;
string c = null;
try
{
Url = "http://opendata.baidu.com/api.php?query=" + strIP + "&co=&resource_id=6006&t=1412300361645&ie=utf8&oe=gbk&cb=op_aladdin_callback&format=json&tn=baidu&cb=jQuery1102026811896078288555_1412299994977&_=1412299994981";
WebRequest wReq = System.Net.WebRequest.Create(Url);
wReq.Timeout = 2000;
WebResponse wResp = wReq.GetResponse();
Stream respStream = wResp.GetResponseStream();
StreamReader reader = new StreamReader(respStream, Encoding.GetEncoding("gb2312"));
Text = reader.ReadToEnd();
//取文本内容中间文字 - 开始
int i = Text.IndexOf("location\":\"") + 11;
int j = Text.IndexOf("titlecont")-5;
c = Text.Substring(i, j - i + 2);
//取文本内容中间文字 - 结束
if (c != "")
{
return c;
}
else
{
c = "未知";
}
}
catch
{
c = "错误";
}
return c;
}
添加IP列表代理后进游戏即可切换到正常日服可领活动和日服箱子!
需代理的IP列表:
23.209.32.118
23.55.0.0/16
31.13.0.0/16
49.51.0.0/16
54.219.160.194
54.183.61.55
119.28.0.0/16
120.204.10.204
178.162.0.0/16
183.36.108.31
183.57.48.33
203.205.0.0/16
223.167.86.33
此方法仅用与[ubuntu 14.04+ debian 8]系统
服务器:系统平台[Debian 8 x64] 测试IP:[149.28.13*.**] 主机:系统平台[Windows 7]
先更新并安装依赖库
apt update && apt upgrade -y
apt install -y git build-essential autotools-dev cdbs debhelper dh-autoreconf dpkg-dev gettext libev-dev libpcre3-dev libudns-dev pkg-config fakeroot devscripts supervisor
ini.cs 源代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace ini_config
{
/// <summary>
/// ini文件类
/// </summary>
public class IniFile
{
private string m_FileName;
public string FileName
{
get { return m_FileName; }
set { m_FileName = value; }
}
[DllImport("kernel32.dll")]
private static extern int GetPrivateProfileInt(
string lpAppName,
string lpKeyName,
int nDefault,
string lpFileName
);
[DllImport("kernel32.dll")]
private static extern int GetPrivateProfileString(
string lpAppName,
string lpKeyName,
string lpDefault,
StringBuilder lpReturnedString,
int nSize,
string lpFileName
);
[DllImport("kernel32.dll")]
private static extern int WritePrivateProfileString(
string lpAppName,
string lpKeyName,
string lpString,
string lpFileName
);
/// <summary>
/// 构造函数
/// </summary>
/// <param name="aFileName">Ini文件路径</param>
public IniFile(string aFileName)
{
this.m_FileName = aFileName;
}
/// <summary>
/// 构造函数
/// </summary>
public IniFile()
{ }
/// <summary>
/// [扩展]读Int数值
/// </summary>
/// <param name="section">节</param>
/// <param name="name">键</param>
/// <param name="def">默认值</param>
/// <returns></returns>
public int ReadInt(string section, string name, int def)
{
return GetPrivateProfileInt(section, name, def, this.m_FileName);
}
/// <summary>
/// [扩展]读取string字符串
/// </summary>
/// <param name="section">节</param>
/// <param name="name">键</param>
/// <param name="def">默认值</param>
/// <returns></returns>
public string ReadString(string section, string name, string def)
{
StringBuilder vRetSb = new StringBuilder(2048);
GetPrivateProfileString(section, name, def, vRetSb, 2048, this.m_FileName);
return vRetSb.ToString();
}
/// <summary>
/// [扩展]写入Int数值,如果不存在 节-键,则会自动创建
/// </summary>
/// <param name="section">节</param>
/// <param name="name">键</param>
/// <param name="Ival">写入值</param>
public void WriteInt(string section, string name, int Ival)
{
WritePrivateProfileString(section, name, Ival.ToString(), this.m_FileName);
}
/// <summary>
/// [扩展]写入String字符串,如果不存在 节-键,则会自动创建
/// </summary>
/// <param name="section">节</param>
/// <param name="name">键</param>
/// <param name="strVal">写入值</param>
public void WriteString(string section, string name, string strVal)
{
WritePrivateProfileString(section, name, strVal, this.m_FileName);
}
/// <summary>
/// 删除指定的 节
/// </summary>
/// <param name="section"></param>
public void DeleteSection(string section)
{
WritePrivateProfileString(section, null, null, this.m_FileName);
}
/// <summary>
/// 删除全部 节
/// </summary>
public void DeleteAllSection()
{
WritePrivateProfileString(null, null, null, this.m_FileName);
}
/// <summary>
/// 读取指定 节-键 的值
/// </summary>
/// <param name="section"></param>
/// <param name="name"></param>
/// <returns></returns>
public string IniReadValue(string section, string name)
{
StringBuilder strSb = new StringBuilder(256);
GetPrivateProfileString(section, name, "", strSb, 256, this.m_FileName);
return strSb.ToString();
}
/// <summary>
/// 写入指定值,如果不存在 节-键,则会自动创建
/// </summary>
/// <param name="section"></param>
/// <param name="name"></param>
/// <param name="value"></param>
public void IniWriteValue(string section, string name, string value)
{
WritePrivateProfileString(section, name, value, this.m_FileName);
}
}
}
源代码:
#!/usr/bin/nev python3
# -*- coding: utf-8 -*-
import os # 先引用 os 模块
user_dir = os.getenv('APPDATA') # 利用 os 模块获取Windows用户 appdata 路径
print(user_dir) # 输出查看路径是否正确
if os.access(user_dir,os.F_OK): # 判断文件是否存在 os.F_OK 用法请看下面
print("文件存在")
else:
print("文件不存在")
HTML源代码:
<html xmlns=http://www.w3.org/1999/xhtml>
<meta http-equiv=Content-Type content="text/html;charset=utf-8">
<title>爬虫测试</title>
<head>
<body>
<h1>任务1:把[P]标签内容利用爬虫全部读取出来.</h1>
<h2>任务2:把[A]标签连接全部利用爬虫读取出来.</h2>
<h2>任务3:把[Img]标签图片地址全部读取出来.</h2>
<h1>任务4:读取完每一个后利用[\n]换行.</h1>
<hr>
<p>Test_P_1</p>
<p>Test_P_2</p>
<p>Test_P_3</p>
<p>Test_P_4</p>
<p>Test_P_5</p>
<hr>
<a href="https://baidu.com">连接1_baidu</a>
<a href="https://byxiaoxie.com">连接2_byxiaoxie</a>
<a href="http://xz.nicokun.com">连接3_nicokun</a>
<hr>
<img src="img_1.jpg" alt="图片1">
<img src="img_2.jpg" alt="图片2">
<img src="img_3.jpg" alt="图片3">
</body>
</head>
</html>