-
Notifications
You must be signed in to change notification settings - Fork 8
/
gname_refactor
executable file
·47 lines (42 loc) · 1.89 KB
/
gname_refactor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/python3
#
import subprocess
import sys
def replace(old, new):
print("%s -> %s" % (old, new))
subprocess.check_call([ "replaceall", "-R", "-vcn", "-g", "*.py", "-s", "JudgementCode.%s" % (old), "-r", "ExperimentalJudgementCodes.%s" % (new), "x509sak" ])
subprocess.check_call([ "replaceall", "-R", "-vcn", "-g", "*.py", "-s", "\"%s\"" % (old), "-r", "\"%s\"" % (new), "x509sak" ])
subprocess.check_call([ "replaceall", "-vcn", "-s", "^([ \t]+%s = )" % (old), "-r", "#\\1", "x509sak/estimate/Judgement.py" ])
prefixes = [
[ "Cert_X509Ext_AuthorityKeyIdentifier_CAName_", "X509Cert_Body_X509Exts_Ext_AKI_CAName_" ],
[ "Cert_X509Ext_IssuerAltName_", "X509Cert_Body_X509Exts_Ext_IAN_Name_" ],
[ "Cert_X509Ext_SubjectAltName_", "X509Cert_Body_X509Exts_Ext_SAN_Name_" ],
[ "Cert_X509Ext_CRLDistributionPoints_PointName_", "X509Cert_Body_X509Exts_Ext_CRLDP_PointName_" ],
[ "Cert_X509Ext_CRLDistributionPoints_CRLIssuer_Name_", "X509Cert_Body_X509Exts_Ext_CRLDP_CRLIssuer_" ],
# [ "", "" ],
# [ "", "" ],
# [ "", "" ],
# [ "", "" ],
]
suffixes = [
# [ "EmptyValue", "" ],
[ "BadIP_Private", "IPAddress_PrivateAddressSpace" ],
[ "BadIP", "IPAddress_Malformed" ],
[ "BadEmail", "Email_Malformed" ],
[ "BadDNSName_Space", "DNS_OnlyWhitespace" ],
[ "BadDNSName_SingleLabel", "DNS_SingleLabel" ],
[ "BadDNSName", "DNS_Malformed" ],
[ "BadURI", "URI_Malformed" ],
[ "UncommonURIScheme", "URI_UncommonURIScheme" ],
[ "BadWildcardDomain_NotLeftmost", "DNS_Wildcard_NotLeftmost" ],
[ "BadWildcardDomain_MoreThanOneWildcard", "DNS_Wildcard_MulitpleWildcards" ],
[ "BadWildcardDomain_InternationalLabel", "DNS_Wildcard_InternationalLabel" ],
[ "BadWildcardDomain_BroadMatch", "DNS_Wildcard_BroadMatch" ],
# [ "", "" ],
# [ "UncommonURIScheme", "" ],
]
for (old_prefix, new_prefix) in prefixes:
for (old_suffix, new_suffix) in suffixes:
old = old_prefix + old_suffix
new = new_prefix + new_suffix
replace(old, new)