通过powershell对原有的py文件字段进行更改
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| $list = Get-ChildItem *.py
$init_name = "name = `'" $init_sev = "severity = `"`"" $ext_name = "漏洞" $key = 1 foreach( $i in $list){ Write-host "No.$key..." $name = $i.Name -replace ".py","" $rep_name = "name = `'$name$ext_name`'" $rep_name $rep_sev = "severity = `"Medium`"" (type "$i" -Encoding utf8) -replace ("$init_name","$rep_name") | Out-File -encoding utf8 -FilePath "$name.py1" (type "$name.py1" -Encoding utf8) -replace ("$init_sev","$rep_sev") | Out-File -encoding utf8 -FilePath "$name.py1" $key++ }
|