scanme.nmap.org is the domain or IP address to be scanned. package main import ( "fmt" "net" "sort" ) func main() { ports := make(chan int, 100) results := make(chan int) var openports []int // Start 100 worker threads for i := 0;…

2021年11月17日 0条评论 1026点热度 0人点赞 痴者工良 阅读全文

scanme.nmap.org 是要扫描的域名或 IP 地址。 package main import ( "fmt" "net" "sort" ) func main() { ports := make(chan int, 100) results := make(chan int) var openports []int // 开启 100 个工作者线程 for i := 0; i < cap(ports); i++ { go worker(ports, results) } // 向[......]继续…

2021年11月17日 0条评论 3333点热度 0人点赞 痴者工良 阅读全文

reflect.Type.Elem() can return the type of the element, for example, for pointer types, it returns the type without the pointer. reflect.Value.Elem() is used to obtain a reference to the value that the pointer points to. type name struct { } func (n name) Prin…

2021年11月16日 0条评论 1106点热度 0人点赞 痴者工良 阅读全文

reflect.Type.Elem() 可以返回元素的类型,例如指针类型,返回不带指针的类型。 reflect.Value.Elem() 是获取指向值的引用。 type name struct { } func (n name) Print(str string) { } func main() { var n interface{} = &name{} t := reflect.TypeOf(n) var na interface{} // 实例化 if t.Kind() == reflect.Ptr {…

2021年11月16日 0条评论 3659点热度 0人点赞 痴者工良 阅读全文

/// <summary> /// Convert between value types and strings /// </summary> public class JsonStringToNumberConverter : JsonConverterFactory { /// <summary> /// Gets the default instance /// </summary> public static JsonStringTo[......]继续阅读

2021年11月3日 1条评论 1212点热度 0人点赞 痴者工良 阅读全文

||其代码如下: /// <summary> /// 值类型和字符串互转 /// </summary> public class JsonStringToNumberConverter : JsonConverterFactory { /// <summary> /// 获取默认实例 /// </summary> public static JsonStringToNumberConverter Default { get; } = new J[......]继续阅读

2021年11月3日 1条评论 4503点热度 0人点赞 痴者工良 阅读全文

In the context of Linux, here's how to invoke a command-line program in Go, with the example code as follows: package main import ( "log" "os" "os/exec" ) func main() { cmd := exec.Command("top") cmd.Stdin = os.Stdin cmd…

2021年10月5日 0条评论 4043点热度 2人点赞 痴者工良 阅读全文

以 Linux 为例,在 Go 中调用一个命令行程序,其代码示例如下: package main import ( "log" "os" "os/exec" ) func main() { cmd := exec.Command("top") cmd.Stdin = os.Stdin cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr if err := cmd.Run(); err != nil { log.Fatal(err) } } 首先使用 cmd[......] 继…

2021年10月5日 0条评论 4109点热度 2人点赞 痴者工良 阅读全文

Manjaro prompts when updating or installing software: 正在下载所需的密钥...... :: 是否导入 PGP 公钥 A85E811EB4CA2E08 ,"Caleb Maclennan <alerque@archlinux.org>"? [Y/n] y :: 是否导入 PGP 公钥 E0959FEA8B550539 ,"George Rawlinson <grawlinson@archlinux.org>&q…

2021年10月5日 0条评论 13699点热度 7人点赞 痴者工良 阅读全文

Manjaro 更新软件、安装软件时,提示: 正在下载所需的密钥...... :: 是否导入 PGP 公钥 A85E811EB4CA2E08 ,"Caleb Maclennan <alerque@archlinux.org>"? [Y/n] y :: 是否导入 PGP 公钥 E0959FEA8B550539 ,"George Rawlinson <grawlinson@archlinux.org>"? [Y/n] y y( 71/771) 正在检查软件包完整性[......]继续阅读

2021年10月5日 0条评论 9941点热度 7人点赞 痴者工良 阅读全文

The poisoned code is as follows: void Main() { Value a = 0; if (a == 1 && a == 2 && a == 3) { Console.WriteLine("毒代码"); return; } Console.WriteLine("代码无毒"); } public class Value { private int _value; public Value() { } publi…

2021年9月25日 0条评论 3836点热度 0人点赞 痴者工良 阅读全文

下毒代码如下: void Main() { Value a = 0; if (a == 1 && a == 2 && a == 3) { Console.WriteLine("给代码下点毒"); return; } Console.WriteLine("代码无毒"); } public class Value { private int _value; public Value() { } public Value(int value) {[......]继续阅读

2021年9月25日 0条评论 4110点热度 0人点赞 痴者工良 阅读全文

The code provided exports a DataTable to a .csv format. public static async Task SaveCSV(DataTable dt,string[] header, string fileName) { StringBuilder sb = new StringBuilder(); sb.Append($"{string.Join(",", header)}\r\n"); for[......]继续阅读

2021年8月23日 0条评论 3706点热度 0人点赞 痴者工良 阅读全文

代码所示,将 Table 导出为 .csv 格式的数据。 public static async Task SaveCSV(DataTable dt,string[] header, string fileName) { StringBuilder sb = new StringBuilder(); sb.Append($"{string.Join(",", header)}\r\n"); for (int i = 0; i < dt.Rows.Count; i++)[......]继续阅读

2021年8月23日 0条评论 3492点热度 0人点赞 痴者工良 阅读全文

Inheriting from IActionResult: public class ResponseResult<TData> : IActionResult { /// <summary> /// Status code /// </summary> public int Code { get; set; } /// <summary> /// Response message /// </summary&[......]继续阅读

2021年8月21日 0条评论 5640点热度 0人点赞 痴者工良 阅读全文

继承 IActionResult: public class ResponseResult<TData> : IActionResult { /// <summary> /// 状态码 /// </summary> public int Code { get; set; } /// <summary> /// 响应信息 /// </summary> public string Msg { g[......]继续阅读

2021年8月21日 0条评论 5610点热度 0人点赞 痴者工良 阅读全文

There are readers suggesting to use app.UseExceptionHandler(); for global exception interception. https://learn.microsoft.com/en-us/aspnet/core/fundamentals/error-handling?view=aspnetcore-9.0 The main difference lies in the middleware position when the request…

2021年8月12日 2条评论 4509点热度 0人点赞 痴者工良 阅读全文

有读者回复推荐全局异常拦截使用 app.UseExceptionHandler();。 https://learn.microsoft.com/en-us/aspnet/core/fundamentals/error-handling?view=aspnetcore-9.0 跟本身的主要区别是请求到达的中间件位置不一样,对于整个 Web 链路生命周期,建议使用 app.UseExceptionHandler();。 本身主要关于 MVC 请求中的异常进行除了。 全局异常拦截器: /// <summary>…

2021年8月12日 2条评论 5085点热度 0人点赞 痴者工良 阅读全文

Directly use the .NET CLR library for generation without relying on third-party frameworks. The code has been updated to the latest implementation, removing deprecated interfaces. The Password-Based Key Derivation Function 2 (PBKDF2) makes it harder for others…

2021年8月12日 0条评论 1112点热度 0人点赞 痴者工良 阅读全文

直接使用 .NET 的 CLR 库生成,不依赖第三方框架。 已将代码修正为最新实现,去掉过时接口。 基于密码的密钥导出函数2(PBKDF2)让别人更难通过穷举法猜到你的帐户密码。 pbkdf2 加密是不可逆的,因此可以用来处理密码等,只能对比,不能还原。 比如说,每个用户设置一个加密密钥,每个用户使用自己的密钥加密密码,且密码不可逆。 即使拿到一个用户的密码,破解了,每个用户的密钥都是不一样的,没法大规模爆破。 /// <summary> /// Pbkdf2 /// </summary> …

2021年8月12日 0条评论 4608点热度 0人点赞 痴者工良 阅读全文
1202122232454