|
|
发表于 2022-4-24 19:46:23
|
显示全部楼层
本帖最后由 xczxczxcz 于 2022-4-24 19:48 编辑
给你一个好玩的,保存为 xxx.ps1, 右键执行
- $a='.\a.txt';
- $b='.\b.txt';
- $c='.\c.txt';
- $hash=[Collections.Generic.HashSet[string]]::new();
- $infoID = @();
- (gc $a -ReadCount 0).foreach{
- $id = $_ -replace '^.*?=|\s+\d+$';
- if($hash.Add($id)){ $infoID+=$id }
- }
- $hash.Clear();
- $user = @();
- (gc $b -ReadCount 0).Foreach{
- $s = $_ -replace '^.*?=(.*?)&.*?-\s+((\d+\.){3}\d+).*$','$2,$1' -split ',';
- if($hash.Add($s[0]+$s[1])){
- $user += @{ $s[0].ToString() = $s[1]}
- }
- }
- $hash.Clear();
- $ipCount=@();
- (gc $c -ReadCount 0).Foreach{
- $s = $_ -replace '^.*?=(.*?)\s.*?-\s+((\d+\.){3}\d+).*$','$1,$2' -split ',';
- if($infoID.contains($s[0])){
- $ipCount+=[PsCustomObject]@{id=$s[0]; ip=$s[1]; name=$user."$($s[1])"; }
- }
- }
- ($ipcount|group name).Foreach{
- $ip =$_.Group[0].ip;
- $name = $_.Name;
- $_.group|group id|%{$ip + "`t" + $name + "`t`t" + $_.Name + "`t" + $_.Count}
- }
- &cmd /c set/p=全部完成 退出<nul`&pause>nul;exit
复制代码 |
|