0
0
mirror of https://codeberg.org/crimeflare/cloudflare-tor synced 2024-11-05 00:42:45 +00:00
This commit is contained in:
u 2020-11-11 03:32:05 +01:00
commit 359887b8af
23 changed files with 2784 additions and 675 deletions

View File

@ -1,15 +1,171 @@
CF:1.0.0.0-1.0.0.255 CF:1.0.0.0-1.0.0.255
CF:1.1.1.0-1.1.1.255 CF:1.1.1.0-1.1.1.255
CF:8.6.112.0-8.6.112.255
CF:8.6.144.0-8.6.144.255
CF:8.6.145.0-8.6.145.255
CF:8.6.146.0-8.6.146.255
CF:8.9.230.0-8.9.230.255
CF:8.9.231.0-8.9.231.255
CF:8.10.148.0-8.10.148.255
CF:8.14.199.0-8.14.199.255
CF:8.14.201.0-8.14.201.255
CF:8.14.202.0-8.14.202.255
CF:8.14.203.0-8.14.203.255
CF:8.14.204.0-8.14.204.255
CF:8.17.205.0-8.17.205.255
CF:8.17.206.0-8.17.206.255
CF:8.17.207.0-8.17.207.255
CF:8.18.50.0-8.18.50.255
CF:8.18.113.0-8.18.113.255
CF:8.18.194.0-8.18.194.255
CF:8.18.195.0-8.18.195.255
CF:8.18.196.0-8.18.196.255
CF:8.19.8.0-8.19.8.255
CF:8.19.10.0-8.19.10.255
CF:8.20.100.0-8.20.100.255
CF:8.20.101.0-8.20.101.255
CF:8.20.103.0-8.20.103.255
CF:8.20.122.0-8.20.122.255
CF:8.20.123.0-8.20.123.255
CF:8.20.124.0-8.20.124.255
CF:8.20.125.0-8.20.125.255
CF:8.20.126.0-8.20.126.255
CF:8.20.127.0-8.20.127.255
CF:8.20.253.0-8.20.253.255
CF:8.21.8.0-8.21.8.255
CF:8.21.9.0-8.21.9.255
CF:8.21.10.0-8.21.10.255
CF:8.21.11.0-8.21.11.255
CF:8.21.13.0-8.21.13.255
CF:8.21.110.0-8.21.110.255
CF:8.21.111.0-8.21.111.255
CF:8.21.238.0-8.21.238.255
CF:8.23.139.0-8.23.139.255
CF:8.23.240.0-8.23.240.255
CF:8.31.160.0-8.31.160.255
CF:8.31.161.0-8.31.161.255
CF:8.35.57.0-8.35.57.255
CF:8.35.58.0-8.35.58.255
CF:8.35.59.0-8.35.59.255
CF:8.35.211.0-8.35.211.255
CF:8.36.216.0-8.36.216.255
CF:8.36.217.0-8.36.217.255
CF:8.36.218.0-8.36.218.255
CF:8.36.219.0-8.36.219.255
CF:8.36.220.0-8.36.220.255
CF:8.37.41.0-8.37.41.255
CF:8.37.43.0-8.37.43.255
CF:8.38.147.0-8.38.147.255
CF:8.38.148.0-8.38.148.255
CF:8.38.149.0-8.38.149.255
CF:8.38.172.0-8.38.172.255
CF:8.39.6.0-8.39.6.255
CF:8.39.18.0-8.39.18.255
CF:8.39.125.0-8.39.125.255
CF:8.39.126.0-8.39.126.255
CF:8.39.127.0-8.39.127.255
CF:8.39.201.0-8.39.201.255
CF:8.39.202.0-8.39.202.255
CF:8.39.203.0-8.39.203.255
CF:8.39.204.0-8.39.204.255
CF:8.39.205.0-8.39.205.255
CF:8.39.206.0-8.39.206.255
CF:8.39.207.0-8.39.207.255
CF:8.39.212.0-8.39.212.255
CF:8.39.213.0-8.39.213.255
CF:8.39.214.0-8.39.214.255
CF:8.39.215.0-8.39.215.255
CF:8.40.26.0-8.40.26.255
CF:8.40.27.0-8.40.27.255
CF:8.40.28.0-8.40.28.255
CF:8.40.29.0-8.40.29.255
CF:8.40.30.0-8.40.30.255
CF:8.40.31.0-8.40.31.255
CF:8.40.107.0-8.40.107.255
CF:8.40.111.0-8.40.111.255
CF:8.40.140.0-8.40.140.255
CF:8.41.5.0-8.41.5.255
CF:8.41.6.0-8.41.6.255
CF:8.41.7.0-8.41.7.255
CF:8.41.36.0-8.41.36.255
CF:8.41.37.0-8.41.37.255
CF:8.41.39.0-8.41.39.255
CF:8.42.51.0-8.42.51.255
CF:8.42.52.0-8.42.52.255
CF:8.42.54.0-8.42.54.255
CF:8.42.55.0-8.42.55.255
CF:8.42.161.0-8.42.161.255
CF:8.42.164.0-8.42.164.255
CF:8.42.172.0-8.42.172.255
CF:8.42.245.0-8.42.245.255
CF:8.43.121.0-8.43.121.255
CF:8.43.122.0-8.43.122.255
CF:8.43.123.0-8.43.123.255
CF:8.43.224.0-8.43.224.255
CF:8.43.225.0-8.43.225.255
CF:8.43.226.0-8.43.226.255
CF:8.44.0.0-8.44.0.255
CF:8.44.1.0-8.44.1.255
CF:8.44.2.0-8.44.2.255
CF:8.44.3.0-8.44.3.255
CF:8.44.6.0-8.44.6.255
CF:8.44.58.0-8.44.58.255
CF:8.44.59.0-8.44.59.255
CF:8.44.60.0-8.44.60.255
CF:8.44.61.0-8.44.61.255
CF:8.44.62.0-8.44.62.255
CF:8.44.63.0-8.44.63.255
CF:8.45.41.0-8.45.41.255
CF:8.45.42.0-8.45.42.255
CF:8.45.43.0-8.45.43.255
CF:8.45.44.0-8.45.44.255
CF:8.45.45.0-8.45.45.255
CF:8.45.46.0-8.45.46.255
CF:8.45.47.0-8.45.47.255
CF:8.45.97.0-8.45.97.255
CF:8.45.100.0-8.45.100.255
CF:8.45.101.0-8.45.101.255
CF:8.45.102.0-8.45.102.255
CF:8.45.108.0-8.45.108.255
CF:8.45.111.0-8.45.111.255
CF:8.45.144.0-8.45.144.255
CF:8.45.145.0-8.45.145.255
CF:8.45.146.0-8.45.146.255
CF:8.45.147.0-8.45.147.255
CF:8.45.151.0-8.45.151.255
CF:8.46.113.0-8.46.113.255
CF:8.46.114.0-8.46.114.255
CF:8.46.115.0-8.46.115.255
CF:8.46.116.0-8.46.116.255
CF:8.46.117.0-8.46.117.255
CF:8.46.118.0-8.46.118.255
CF:8.46.119.0-8.46.119.255
CF:8.47.9.0-8.47.9.255
CF:8.47.12.0-8.47.12.255
CF:8.47.13.0-8.47.13.255
CF:8.47.14.0-8.47.14.255
CF:8.47.15.0-8.47.15.255
CF:8.47.69.0-8.47.69.255
CF:8.47.71.0-8.47.71.255
CF:8.48.130.0-8.48.130.255
CF:8.48.131.0-8.48.131.255
CF:8.48.132.0-8.48.132.255
CF:8.48.133.0-8.48.133.255
CF:8.48.134.0-8.48.134.255
CF:23.227.38.0-23.227.39.255
CF:64.68.192.0-64.68.192.255
CF:66.235.200.0-66.235.200.255
CF:89.47.56.0-89.47.57.255
CF:91.132.150.0-91.132.151.255
CF:91.226.97.0-91.226.97.255
CF:93.114.64.0-93.114.65.255
CF:103.21.244.0-103.21.247.255 CF:103.21.244.0-103.21.247.255
CF:103.21.246.0-103.21.246.255 CF:103.21.246.0-103.21.246.255
CF:103.21.247.0-103.21.247.255 CF:103.21.247.0-103.21.247.255
CF:103.22.200.0-103.22.201.255
CF:103.22.200.0-103.22.203.255 CF:103.22.200.0-103.22.203.255
CF:103.22.202.0-103.22.202.255 CF:103.22.202.0-103.22.202.255
CF:103.22.203.0-103.22.203.255 CF:103.22.203.0-103.22.203.255
CF:103.31.4.0-103.31.5.255
CF:103.31.4.0-103.31.7.255 CF:103.31.4.0-103.31.7.255
CF:104.16.0.0-104.16.15.255
CF:104.16.0.0-104.31.255.255 CF:104.16.0.0-104.31.255.255
CF:104.16.16.0-104.16.31.255 CF:104.16.16.0-104.16.31.255
CF:104.16.32.0-104.16.47.255 CF:104.16.32.0-104.16.47.255
@ -44,7 +200,7 @@ CF:104.17.224.0-104.17.239.255
CF:104.17.240.0-104.17.255.255 CF:104.17.240.0-104.17.255.255
CF:104.18.0.0-104.18.15.255 CF:104.18.0.0-104.18.15.255
CF:104.18.16.0-104.18.31.255 CF:104.18.16.0-104.18.31.255
CF:104.18.32.0-104.18.47.255 CF:104.18.32.0-104.18.63.255
CF:104.18.48.0-104.18.63.255 CF:104.18.48.0-104.18.63.255
CF:104.18.64.0-104.18.79.255 CF:104.18.64.0-104.18.79.255
CF:104.18.80.0-104.18.95.255 CF:104.18.80.0-104.18.95.255
@ -90,7 +246,14 @@ CF:104.20.192.0-104.20.207.255
CF:104.20.208.0-104.20.223.255 CF:104.20.208.0-104.20.223.255
CF:104.20.224.0-104.20.239.255 CF:104.20.224.0-104.20.239.255
CF:104.20.240.0-104.20.255.255 CF:104.20.240.0-104.20.255.255
CF:104.21.64.0-104.21.95.255
CF:104.21.192.0-104.21.207.255
CF:104.21.224.0-104.21.239.255
CF:104.22.0.0-104.22.15.255 CF:104.22.0.0-104.22.15.255
CF:104.22.16.0-104.22.31.255
CF:104.22.32.0-104.22.47.255
CF:104.22.48.0-104.22.63.255
CF:104.22.64.0-104.22.79.255
CF:104.23.96.0-104.23.111.255 CF:104.23.96.0-104.23.111.255
CF:104.23.112.0-104.23.127.255 CF:104.23.112.0-104.23.127.255
CF:104.23.128.0-104.23.143.255 CF:104.23.128.0-104.23.143.255
@ -102,7 +265,7 @@ CF:104.24.32.0-104.24.47.255
CF:104.24.48.0-104.24.63.255 CF:104.24.48.0-104.24.63.255
CF:104.24.64.0-104.24.79.255 CF:104.24.64.0-104.24.79.255
CF:104.24.80.0-104.24.95.255 CF:104.24.80.0-104.24.95.255
CF:104.24.96.0-104.24.111.255 CF:104.24.96.0-104.24.127.255
CF:104.24.112.0-104.24.127.255 CF:104.24.112.0-104.24.127.255
CF:104.24.128.0-104.24.143.255 CF:104.24.128.0-104.24.143.255
CF:104.24.144.0-104.24.159.255 CF:104.24.144.0-104.24.159.255
@ -137,43 +300,47 @@ CF:104.27.64.0-104.27.79.255
CF:104.27.80.0-104.27.95.255 CF:104.27.80.0-104.27.95.255
CF:104.27.96.0-104.27.111.255 CF:104.27.96.0-104.27.111.255
CF:104.27.112.0-104.27.127.255 CF:104.27.112.0-104.27.127.255
CF:104.27.128.0-104.27.143.255 CF:104.27.128.0-104.27.159.255
CF:104.27.144.0-104.27.159.255 CF:104.27.144.0-104.27.159.255
CF:104.27.160.0-104.27.175.255 CF:104.27.160.0-104.27.191.255
CF:104.27.176.0-104.27.191.255 CF:104.27.176.0-104.27.191.255
CF:104.27.192.0-104.27.207.255 CF:104.27.192.0-104.27.207.255
CF:104.27.208.0-104.27.223.255 CF:104.27.208.0-104.27.223.255
CF:104.27.240.0-104.27.243.255 CF:104.27.240.0-104.27.243.255
CF:104.28.0.0-104.28.15.255 CF:104.28.0.0-104.28.31.255
CF:104.28.16.0-104.28.31.255 CF:104.28.16.0-104.28.31.255
CF:104.28.32.0-104.28.47.255 CF:104.28.32.0-104.28.63.255
CF:104.28.48.0-104.28.63.255 CF:104.28.48.0-104.28.63.255
CF:104.28.64.0-104.28.79.255 CF:104.28.64.0-104.28.95.255
CF:104.28.80.0-104.28.95.255 CF:104.28.80.0-104.28.95.255
CF:104.28.96.0-104.28.111.255 CF:104.28.96.0-104.28.127.255
CF:104.28.112.0-104.28.127.255 CF:104.28.112.0-104.28.127.255
CF:104.28.128.0-104.28.143.255 CF:104.28.128.0-104.28.159.255
CF:104.28.144.0-104.28.159.255 CF:104.28.144.0-104.28.159.255
CF:104.28.160.0-104.28.175.255 CF:104.28.160.0-104.28.191.255
CF:104.28.176.0-104.28.191.255 CF:104.28.176.0-104.28.191.255
CF:104.28.192.0-104.28.207.255 CF:104.28.192.0-104.28.223.255
CF:104.28.208.0-104.28.223.255 CF:104.28.208.0-104.28.223.255
CF:104.28.224.0-104.28.239.255 CF:104.28.224.0-104.28.255.255
CF:104.28.240.0-104.28.255.255 CF:104.28.240.0-104.28.255.255
CF:104.31.0.0-104.31.15.255 CF:104.31.0.0-104.31.15.255
CF:104.31.16.0-104.31.31.255 CF:104.31.16.0-104.31.31.255
CF:104.31.64.0-104.31.79.255 CF:104.31.64.0-104.31.95.255
CF:104.31.80.0-104.31.95.255 CF:104.31.80.0-104.31.95.255
CF:104.31.112.0-104.31.115.255 CF:104.31.112.0-104.31.115.255
CF:104.31.128.0-104.31.143.255 CF:104.31.128.0-104.31.159.255
CF:104.31.144.0-104.31.159.255 CF:104.31.144.0-104.31.159.255
CF:104.31.160.0-104.31.175.255 CF:104.31.160.0-104.31.191.255
CF:104.31.176.0-104.31.191.255 CF:104.31.176.0-104.31.191.255
CF:104.31.192.0-104.31.207.255 CF:104.31.192.0-104.31.223.255
CF:104.31.208.0-104.31.223.255 CF:104.31.208.0-104.31.223.255
CF:104.31.224.0-104.31.239.255 CF:104.31.224.0-104.31.255.255
CF:104.31.240.0-104.31.255.255 CF:104.31.240.0-104.31.255.255
CF:108.162.192.0-108.162.255.255 CF:108.162.192.0-108.162.255.255
CF:108.162.193.0-108.162.193.255
CF:108.162.194.0-108.162.194.255
CF:108.162.195.0-108.162.195.255
CF:108.162.196.0-108.162.196.255
CF:108.162.208.0-108.162.208.255 CF:108.162.208.0-108.162.208.255
CF:108.162.210.0-108.162.210.255 CF:108.162.210.0-108.162.210.255
CF:108.162.211.0-108.162.211.255 CF:108.162.211.0-108.162.211.255
@ -210,9 +377,9 @@ CF:108.162.248.0-108.162.248.255
CF:108.162.249.0-108.162.249.255 CF:108.162.249.0-108.162.249.255
CF:108.162.250.0-108.162.250.255 CF:108.162.250.0-108.162.250.255
CF:108.162.252.0-108.162.252.255 CF:108.162.252.0-108.162.252.255
CF:108.162.253.0-108.162.253.255
CF:108.162.255.0-108.162.255.255 CF:108.162.255.0-108.162.255.255
CF:131.0.72.0-131.0.75.255 CF:131.0.72.0-131.0.75.255
CF:141.101.64.0-141.101.64.255
CF:141.101.64.0-141.101.127.255 CF:141.101.64.0-141.101.127.255
CF:141.101.65.0-141.101.65.255 CF:141.101.65.0-141.101.65.255
CF:141.101.66.0-141.101.66.255 CF:141.101.66.0-141.101.66.255
@ -246,11 +413,10 @@ CF:141.101.108.0-141.101.108.255
CF:141.101.109.0-141.101.109.255 CF:141.101.109.0-141.101.109.255
CF:141.101.110.0-141.101.110.255 CF:141.101.110.0-141.101.110.255
CF:141.101.111.0-141.101.111.255 CF:141.101.111.0-141.101.111.255
CF:141.101.112.0-141.101.113.255
CF:141.101.112.0-141.101.127.255 CF:141.101.112.0-141.101.127.255
CF:141.101.114.0-141.101.115.255 CF:141.101.114.0-141.101.115.255
CF:141.101.120.0-141.101.123.255 CF:141.101.120.0-141.101.123.255
CF:162.158.0.0-162.158.3.255 CF:141.193.213.0-141.193.213.255
CF:162.158.0.0-162.159.255.255 CF:162.158.0.0-162.159.255.255
CF:162.158.4.0-162.158.7.255 CF:162.158.4.0-162.158.7.255
CF:162.158.8.0-162.158.8.255 CF:162.158.8.0-162.158.8.255
@ -260,7 +426,7 @@ CF:162.158.11.0-162.158.11.255
CF:162.158.12.0-162.158.15.255 CF:162.158.12.0-162.158.15.255
CF:162.158.16.0-162.158.19.255 CF:162.158.16.0-162.158.19.255
CF:162.158.20.0-162.158.23.255 CF:162.158.20.0-162.158.23.255
CF:162.158.24.0-162.158.24.255 CF:162.158.24.0-162.158.25.255
CF:162.158.25.0-162.158.25.255 CF:162.158.25.0-162.158.25.255
CF:162.158.26.0-162.158.26.255 CF:162.158.26.0-162.158.26.255
CF:162.158.27.0-162.158.27.255 CF:162.158.27.0-162.158.27.255
@ -277,7 +443,7 @@ CF:162.158.40.0-162.158.40.255
CF:162.158.41.0-162.158.41.255 CF:162.158.41.0-162.158.41.255
CF:162.158.42.0-162.158.42.255 CF:162.158.42.0-162.158.42.255
CF:162.158.43.0-162.158.43.255 CF:162.158.43.0-162.158.43.255
CF:162.158.44.0-162.158.44.255 CF:162.158.44.0-162.158.47.255
CF:162.158.45.0-162.158.45.255 CF:162.158.45.0-162.158.45.255
CF:162.158.46.0-162.158.46.255 CF:162.158.46.0-162.158.46.255
CF:162.158.47.0-162.158.47.255 CF:162.158.47.0-162.158.47.255
@ -285,25 +451,23 @@ CF:162.158.48.0-162.158.48.255
CF:162.158.49.0-162.158.49.255 CF:162.158.49.0-162.158.49.255
CF:162.158.50.0-162.158.50.255 CF:162.158.50.0-162.158.50.255
CF:162.158.51.0-162.158.51.255 CF:162.158.51.0-162.158.51.255
CF:162.158.52.0-162.158.52.255 CF:162.158.52.0-162.158.55.255
CF:162.158.53.0-162.158.53.255 CF:162.158.53.0-162.158.53.255
CF:162.158.54.0-162.158.54.255 CF:162.158.54.0-162.158.54.255
CF:162.158.55.0-162.158.55.255 CF:162.158.55.0-162.158.55.255
CF:162.158.56.0-162.158.59.255 CF:162.158.56.0-162.158.59.255
CF:162.158.59.0-162.158.59.255
CF:162.158.60.0-162.158.63.255 CF:162.158.60.0-162.158.63.255
CF:162.158.64.0-162.158.67.255
CF:162.158.64.0-162.158.71.255 CF:162.158.64.0-162.158.71.255
CF:162.158.72.0-162.158.75.255 CF:162.158.72.0-162.158.75.255
CF:162.158.76.0-162.158.79.255 CF:162.158.76.0-162.158.79.255
CF:162.158.82.0-162.158.82.255 CF:162.158.80.0-162.158.81.255
CF:162.158.82.0-162.158.83.255 CF:162.158.82.0-162.158.83.255
CF:162.158.83.0-162.158.83.255 CF:162.158.83.0-162.158.83.255
CF:162.158.84.0-162.158.84.255
CF:162.158.84.0-162.158.87.255 CF:162.158.84.0-162.158.87.255
CF:162.158.85.0-162.158.85.255 CF:162.158.85.0-162.158.85.255
CF:162.158.86.0-162.158.86.255 CF:162.158.86.0-162.158.86.255
CF:162.158.87.0-162.158.87.255 CF:162.158.87.0-162.158.87.255
CF:162.158.88.0-162.158.88.255
CF:162.158.88.0-162.158.95.255 CF:162.158.88.0-162.158.95.255
CF:162.158.89.0-162.158.89.255 CF:162.158.89.0-162.158.89.255
CF:162.158.90.0-162.158.90.255 CF:162.158.90.0-162.158.90.255
@ -350,6 +514,8 @@ CF:162.158.145.0-162.158.145.255
CF:162.158.146.0-162.158.146.255 CF:162.158.146.0-162.158.146.255
CF:162.158.147.0-162.158.147.255 CF:162.158.147.0-162.158.147.255
CF:162.158.148.0-162.158.151.255 CF:162.158.148.0-162.158.151.255
CF:162.158.149.0-162.158.149.255
CF:162.158.151.0-162.158.151.255
CF:162.158.152.0-162.158.155.255 CF:162.158.152.0-162.158.155.255
CF:162.158.156.0-162.158.159.255 CF:162.158.156.0-162.158.159.255
CF:162.158.160.0-162.158.175.255 CF:162.158.160.0-162.158.175.255
@ -377,21 +543,27 @@ CF:162.158.199.0-162.158.199.255
CF:162.158.200.0-162.158.203.255 CF:162.158.200.0-162.158.203.255
CF:162.158.204.0-162.158.205.255 CF:162.158.204.0-162.158.205.255
CF:162.158.206.0-162.158.207.255 CF:162.158.206.0-162.158.207.255
CF:162.158.207.0-162.158.207.255
CF:162.158.208.0-162.158.211.255 CF:162.158.208.0-162.158.211.255
CF:162.158.212.0-162.158.215.255 CF:162.158.212.0-162.158.215.255
CF:162.158.213.0-162.158.213.255
CF:162.158.214.0-162.158.214.255
CF:162.158.215.0-162.158.215.255
CF:162.158.216.0-162.158.217.255 CF:162.158.216.0-162.158.217.255
CF:162.158.218.0-162.158.219.255 CF:162.158.218.0-162.158.219.255
CF:162.158.220.0-162.158.223.255 CF:162.158.220.0-162.158.223.255
CF:162.158.224.0-162.158.227.255 CF:162.158.224.0-162.158.227.255
CF:162.158.225.0-162.158.225.255
CF:162.158.226.0-162.158.227.255
CF:162.158.228.0-162.158.231.255 CF:162.158.228.0-162.158.231.255
CF:162.158.232.0-162.158.235.255 CF:162.158.232.0-162.158.235.255
CF:162.158.234.0-162.158.235.255
CF:162.158.236.0-162.158.239.255 CF:162.158.236.0-162.158.239.255
CF:162.158.240.0-162.158.243.255 CF:162.158.240.0-162.158.243.255
CF:162.158.244.0-162.158.247.255 CF:162.158.244.0-162.158.247.255
CF:162.158.248.0-162.158.249.255
CF:162.158.248.0-162.158.251.255 CF:162.158.248.0-162.158.251.255
CF:162.158.250.0-162.158.251.255
CF:162.158.252.0-162.158.255.255 CF:162.158.252.0-162.158.255.255
CF:162.159.0.0-162.159.0.255
CF:162.159.0.0-162.159.15.255 CF:162.159.0.0-162.159.15.255
CF:162.159.1.0-162.159.1.255 CF:162.159.1.0-162.159.1.255
CF:162.159.2.0-162.159.2.255 CF:162.159.2.0-162.159.2.255
@ -408,7 +580,6 @@ CF:162.159.12.0-162.159.12.255
CF:162.159.13.0-162.159.13.255 CF:162.159.13.0-162.159.13.255
CF:162.159.14.0-162.159.14.255 CF:162.159.14.0-162.159.14.255
CF:162.159.15.0-162.159.15.255 CF:162.159.15.0-162.159.15.255
CF:162.159.16.0-162.159.16.255
CF:162.159.16.0-162.159.31.255 CF:162.159.16.0-162.159.31.255
CF:162.159.17.0-162.159.17.255 CF:162.159.17.0-162.159.17.255
CF:162.159.18.0-162.159.18.255 CF:162.159.18.0-162.159.18.255
@ -425,28 +596,40 @@ CF:162.159.28.0-162.159.28.255
CF:162.159.29.0-162.159.29.255 CF:162.159.29.0-162.159.29.255
CF:162.159.30.0-162.159.30.255 CF:162.159.30.0-162.159.30.255
CF:162.159.31.0-162.159.31.255 CF:162.159.31.0-162.159.31.255
CF:162.159.32.0-162.159.33.255 CF:162.159.32.0-162.159.47.255
CF:162.159.34.0-162.159.35.255 CF:162.159.34.0-162.159.35.255
CF:162.159.36.0-162.159.36.255 CF:162.159.36.0-162.159.36.255
CF:162.159.40.0-162.159.41.255 CF:162.159.40.0-162.159.41.255
CF:162.159.42.0-162.159.43.255 CF:162.159.42.0-162.159.43.255
CF:162.159.46.0-162.159.46.255 CF:162.159.46.0-162.159.46.255
CF:162.159.128.0-162.159.159.255 CF:162.159.48.0-162.159.63.255
CF:162.159.64.0-162.159.79.255
CF:162.159.128.0-162.159.255.255 CF:162.159.128.0-162.159.255.255
CF:162.159.132.0-162.159.132.255 CF:162.159.132.0-162.159.132.255
CF:162.159.208.0-162.159.208.255 CF:162.159.160.0-162.159.160.255
CF:162.159.192.0-162.159.195.255
CF:162.159.200.0-162.159.200.255
CF:162.159.208.0-162.159.211.255 CF:162.159.208.0-162.159.211.255
CF:162.159.209.0-162.159.209.255 CF:162.159.209.0-162.159.209.255
CF:162.159.210.0-162.159.210.255 CF:162.159.210.0-162.159.210.255
CF:162.159.211.0-162.159.211.255 CF:162.159.211.0-162.159.211.255
CF:162.159.212.0-162.159.215.255
CF:162.159.216.0-162.159.223.255
CF:162.159.224.0-162.159.239.255 CF:162.159.224.0-162.159.239.255
CF:172.64.0.0-172.64.15.255 CF:162.159.240.0-162.159.255.255
CF:172.64.0.0-172.64.255.255 CF:162.247.243.0-162.247.243.255
CF:162.251.82.0-162.251.82.255
CF:172.64.0.0-172.71.255.255 CF:172.64.0.0-172.71.255.255
CF:172.64.16.0-172.64.31.255 CF:172.64.16.0-172.64.31.255
CF:172.64.32.0-172.64.47.255 CF:172.64.32.0-172.64.47.255
CF:172.64.33.0-172.64.33.255
CF:172.64.34.0-172.64.34.255
CF:172.64.35.0-172.64.35.255
CF:172.64.36.0-172.64.37.255
CF:172.64.38.0-172.64.38.255
CF:172.64.48.0-172.64.63.255 CF:172.64.48.0-172.64.63.255
CF:172.64.64.0-172.64.79.255 CF:172.64.64.0-172.64.79.255
CF:172.64.80.0-172.64.95.255
CF:172.64.96.0-172.64.111.255 CF:172.64.96.0-172.64.111.255
CF:172.64.112.0-172.64.127.255 CF:172.64.112.0-172.64.127.255
CF:172.64.128.0-172.64.143.255 CF:172.64.128.0-172.64.143.255
@ -455,9 +638,10 @@ CF:172.64.160.0-172.64.175.255
CF:172.64.176.0-172.64.191.255 CF:172.64.176.0-172.64.191.255
CF:172.64.192.0-172.64.207.255 CF:172.64.192.0-172.64.207.255
CF:172.64.208.0-172.64.223.255 CF:172.64.208.0-172.64.223.255
CF:172.65.0.0-172.65.15.255 CF:172.64.240.0-172.64.255.255
CF:172.65.0.0-172.65.31.255
CF:172.65.16.0-172.65.31.255 CF:172.65.16.0-172.65.31.255
CF:172.65.32.0-172.65.47.255 CF:172.65.32.0-172.65.63.255
CF:172.65.48.0-172.65.63.255 CF:172.65.48.0-172.65.63.255
CF:172.65.64.0-172.65.79.255 CF:172.65.64.0-172.65.79.255
CF:172.65.80.0-172.65.95.255 CF:172.65.80.0-172.65.95.255
@ -471,13 +655,35 @@ CF:172.65.192.0-172.65.207.255
CF:172.65.208.0-172.65.223.255 CF:172.65.208.0-172.65.223.255
CF:172.65.224.0-172.65.239.255 CF:172.65.224.0-172.65.239.255
CF:172.65.240.0-172.65.255.255 CF:172.65.240.0-172.65.255.255
CF:172.67.0.0-172.67.15.255
CF:172.67.16.0-172.67.31.255
CF:172.67.32.0-172.67.47.255
CF:172.67.48.0-172.67.63.255
CF:172.67.64.0-172.67.79.255
CF:172.67.80.0-172.67.95.255
CF:172.67.96.0-172.67.111.255
CF:172.67.112.0-172.67.127.255
CF:172.67.128.0-172.67.143.255
CF:172.67.144.0-172.67.159.255
CF:172.67.160.0-172.67.175.255
CF:172.67.176.0-172.67.191.255
CF:172.67.192.0-172.67.207.255
CF:172.67.208.0-172.67.223.255
CF:172.67.224.0-172.67.239.255
CF:172.67.240.0-172.67.255.255
CF:172.68.0.0-172.68.3.255 CF:172.68.0.0-172.68.3.255
CF:172.68.4.0-172.68.7.255 CF:172.68.4.0-172.68.7.255
CF:172.68.8.0-172.68.11.255 CF:172.68.8.0-172.68.11.255
CF:172.68.12.0-172.68.15.255 CF:172.68.12.0-172.68.15.255
CF:172.68.16.0-172.68.31.255 CF:172.68.16.0-172.68.31.255
CF:172.68.24.0-172.68.27.255
CF:172.68.28.0-172.68.28.255
CF:172.68.29.0-172.68.29.255
CF:172.68.30.0-172.68.30.255
CF:172.68.31.0-172.68.31.255
CF:172.68.32.0-172.68.35.255 CF:172.68.32.0-172.68.35.255
CF:172.68.36.0-172.68.39.255 CF:172.68.36.0-172.68.39.255
CF:172.68.38.0-172.68.38.255
CF:172.68.40.0-172.68.43.255 CF:172.68.40.0-172.68.43.255
CF:172.68.44.0-172.68.47.255 CF:172.68.44.0-172.68.47.255
CF:172.68.48.0-172.68.51.255 CF:172.68.48.0-172.68.51.255
@ -501,10 +707,12 @@ CF:172.68.104.0-172.68.107.255
CF:172.68.108.0-172.68.111.255 CF:172.68.108.0-172.68.111.255
CF:172.68.112.0-172.68.115.255 CF:172.68.112.0-172.68.115.255
CF:172.68.116.0-172.68.119.255 CF:172.68.116.0-172.68.119.255
CF:172.68.120.0-172.68.121.255
CF:172.68.120.0-172.68.123.255 CF:172.68.120.0-172.68.123.255
CF:172.68.124.0-172.68.127.255 CF:172.68.124.0-172.68.127.255
CF:172.68.128.0-172.68.131.255 CF:172.68.128.0-172.68.131.255
CF:172.68.129.0-172.68.129.255
CF:172.68.130.0-172.68.130.255
CF:172.68.131.0-172.68.131.255
CF:172.68.132.0-172.68.135.255 CF:172.68.132.0-172.68.135.255
CF:172.68.136.0-172.68.139.255 CF:172.68.136.0-172.68.139.255
CF:172.68.140.0-172.68.143.255 CF:172.68.140.0-172.68.143.255
@ -515,6 +723,9 @@ CF:172.68.160.0-172.68.163.255
CF:172.68.164.0-172.68.165.255 CF:172.68.164.0-172.68.165.255
CF:172.68.166.0-172.68.167.255 CF:172.68.166.0-172.68.167.255
CF:172.68.168.0-172.68.169.255 CF:172.68.168.0-172.68.169.255
CF:172.68.169.0-172.68.169.255
CF:172.68.170.0-172.68.170.255
CF:172.68.171.0-172.68.171.255
CF:172.68.172.0-172.68.175.255 CF:172.68.172.0-172.68.175.255
CF:172.68.176.0-172.68.179.255 CF:172.68.176.0-172.68.179.255
CF:172.68.180.0-172.68.183.255 CF:172.68.180.0-172.68.183.255
@ -534,16 +745,28 @@ CF:172.68.236.0-172.68.239.255
CF:172.68.240.0-172.68.243.255 CF:172.68.240.0-172.68.243.255
CF:172.68.244.0-172.68.247.255 CF:172.68.244.0-172.68.247.255
CF:172.68.248.0-172.68.255.255 CF:172.68.248.0-172.68.255.255
CF:172.69.0.0-172.69.1.255
CF:172.69.0.0-172.69.3.255 CF:172.69.0.0-172.69.3.255
CF:172.69.2.0-172.69.2.255
CF:172.69.3.0-172.69.3.255
CF:172.69.4.0-172.69.7.255 CF:172.69.4.0-172.69.7.255
CF:172.69.8.0-172.69.11.255 CF:172.69.8.0-172.69.11.255
CF:172.69.12.0-172.69.15.255 CF:172.69.12.0-172.69.12.255
CF:172.69.14.0-172.69.14.255
CF:172.69.15.0-172.69.15.255
CF:172.69.16.0-172.69.31.255 CF:172.69.16.0-172.69.31.255
CF:172.69.17.0-172.69.17.255
CF:172.69.18.0-172.69.18.255
CF:172.69.19.0-172.69.19.255
CF:172.69.20.0-172.69.23.255
CF:172.69.24.0-172.69.31.255
CF:172.69.32.0-172.69.35.255 CF:172.69.32.0-172.69.35.255
CF:172.69.36.0-172.69.37.255 CF:172.69.36.0-172.69.37.255
CF:172.69.38.0-172.69.39.255
CF:172.69.40.0-172.69.43.255 CF:172.69.40.0-172.69.43.255
CF:172.69.44.0-172.69.47.255 CF:172.69.44.0-172.69.47.255
CF:172.69.45.0-172.69.45.255
CF:172.69.46.0-172.69.46.255
CF:172.69.47.0-172.69.47.255
CF:172.69.48.0-172.69.51.255 CF:172.69.48.0-172.69.51.255
CF:172.69.52.0-172.69.55.255 CF:172.69.52.0-172.69.55.255
CF:172.69.56.0-172.69.59.255 CF:172.69.56.0-172.69.59.255
@ -559,6 +782,8 @@ CF:172.69.96.0-172.69.99.255
CF:172.69.100.0-172.69.103.255 CF:172.69.100.0-172.69.103.255
CF:172.69.104.0-172.69.107.255 CF:172.69.104.0-172.69.107.255
CF:172.69.108.0-172.69.111.255 CF:172.69.108.0-172.69.111.255
CF:172.69.110.0-172.69.110.255
CF:172.69.111.0-172.69.111.255
CF:172.69.112.0-172.69.115.255 CF:172.69.112.0-172.69.115.255
CF:172.69.116.0-172.69.119.255 CF:172.69.116.0-172.69.119.255
CF:172.69.120.0-172.69.123.255 CF:172.69.120.0-172.69.123.255
@ -571,7 +796,13 @@ CF:172.69.144.0-172.69.147.255
CF:172.69.148.0-172.69.151.255 CF:172.69.148.0-172.69.151.255
CF:172.69.152.0-172.69.155.255 CF:172.69.152.0-172.69.155.255
CF:172.69.156.0-172.69.159.255 CF:172.69.156.0-172.69.159.255
CF:172.69.157.0-172.69.157.255
CF:172.69.158.0-172.69.158.255
CF:172.69.159.0-172.69.159.255
CF:172.69.160.0-172.69.163.255 CF:172.69.160.0-172.69.163.255
CF:172.69.161.0-172.69.161.255
CF:172.69.162.0-172.69.162.255
CF:172.69.163.0-172.69.163.255
CF:172.69.164.0-172.69.167.255 CF:172.69.164.0-172.69.167.255
CF:172.69.168.0-172.69.171.255 CF:172.69.168.0-172.69.171.255
CF:172.69.172.0-172.69.175.255 CF:172.69.172.0-172.69.175.255
@ -586,21 +817,28 @@ CF:172.69.204.0-172.69.207.255
CF:172.69.208.0-172.69.211.255 CF:172.69.208.0-172.69.211.255
CF:172.69.212.0-172.69.215.255 CF:172.69.212.0-172.69.215.255
CF:172.69.216.0-172.69.219.255 CF:172.69.216.0-172.69.219.255
CF:172.69.217.0-172.69.217.255
CF:172.69.218.0-172.69.218.255
CF:172.69.219.0-172.69.219.255
CF:172.69.220.0-172.69.223.255 CF:172.69.220.0-172.69.223.255
CF:172.69.224.0-172.69.225.255
CF:172.69.224.0-172.69.227.255 CF:172.69.224.0-172.69.227.255
CF:172.69.226.0-172.69.227.255 CF:172.69.226.0-172.69.227.255
CF:172.69.227.0-172.69.227.255
CF:172.69.228.0-172.69.231.255 CF:172.69.228.0-172.69.231.255
CF:172.69.232.0-172.69.235.255 CF:172.69.232.0-172.69.235.255
CF:172.69.234.0-172.69.234.255
CF:172.69.235.0-172.69.235.255
CF:172.69.236.0-172.69.239.255 CF:172.69.236.0-172.69.239.255
CF:172.69.240.0-172.69.243.255 CF:172.69.240.0-172.69.243.255
CF:172.69.244.0-172.69.245.255
CF:172.69.244.0-172.69.247.255 CF:172.69.244.0-172.69.247.255
CF:172.69.246.0-172.69.247.255 CF:172.69.246.0-172.69.247.255
CF:172.69.248.0-172.69.251.255 CF:172.69.248.0-172.69.251.255
CF:172.69.252.0-172.69.255.255 CF:172.69.252.0-172.69.255.255
CF:173.245.48.0-173.245.48.255 CF:172.69.253.0-172.69.253.255
CF:172.69.254.0-172.69.254.255
CF:172.69.255.0-172.69.255.255
CF:173.245.48.0-173.245.63.255 CF:173.245.48.0-173.245.63.255
CF:173.245.49.0-173.245.49.255
CF:173.245.52.0-173.245.52.255 CF:173.245.52.0-173.245.52.255
CF:173.245.54.0-173.245.54.255 CF:173.245.54.0-173.245.54.255
CF:173.245.56.0-173.245.56.255 CF:173.245.56.0-173.245.56.255
@ -609,8 +847,11 @@ CF:173.245.59.0-173.245.59.255
CF:173.245.60.0-173.245.61.255 CF:173.245.60.0-173.245.61.255
CF:173.245.62.0-173.245.62.255 CF:173.245.62.0-173.245.62.255
CF:173.245.63.0-173.245.63.255 CF:173.245.63.0-173.245.63.255
CF:176.126.206.0-176.126.207.255
CF:185.122.0.0-185.122.0.255 CF:185.122.0.0-185.122.0.255
CF:188.114.96.0-188.114.96.255 CF:185.171.230.0-185.171.231.255
CF:185.193.28.0-185.193.29.255
CF:185.193.30.0-185.193.31.255
CF:188.114.96.0-188.114.111.255 CF:188.114.96.0-188.114.111.255
CF:188.114.97.0-188.114.97.255 CF:188.114.97.0-188.114.97.255
CF:188.114.98.0-188.114.98.255 CF:188.114.98.0-188.114.98.255
@ -627,26 +868,23 @@ CF:188.114.110.0-188.114.110.255
CF:188.114.111.0-188.114.111.255 CF:188.114.111.0-188.114.111.255
CF:190.93.240.0-190.93.255.255 CF:190.93.240.0-190.93.255.255
CF:190.93.244.0-190.93.247.255 CF:190.93.244.0-190.93.247.255
CF:197.234.240.0-197.234.240.255 CF:193.135.101.0-193.135.101.255
CF:197.234.240.0-197.234.243.255 CF:197.234.240.0-197.234.243.255
CF:197.234.241.0-197.234.241.255 CF:197.234.241.0-197.234.241.255
CF:197.234.242.0-197.234.242.255 CF:197.234.242.0-197.234.242.255
CF:197.234.243.0-197.234.243.255 CF:197.234.243.0-197.234.243.255
CF:198.41.128.0-198.41.128.255
CF:198.41.128.0-198.41.255.255 CF:198.41.128.0-198.41.255.255
CF:198.41.129.0-198.41.129.255 CF:198.41.129.0-198.41.129.255
CF:198.41.130.0-198.41.130.255 CF:198.41.130.0-198.41.130.255
CF:198.41.132.0-198.41.135.255 CF:198.41.132.0-198.41.135.255
CF:198.41.136.0-198.41.139.255 CF:198.41.136.0-198.41.139.255
CF:198.41.144.0-198.41.144.255
CF:198.41.144.0-198.41.147.255 CF:198.41.144.0-198.41.147.255
CF:198.41.148.0-198.41.148.255
CF:198.41.148.0-198.41.151.255 CF:198.41.148.0-198.41.151.255
CF:198.41.152.0-198.41.155.255 CF:198.41.152.0-198.41.155.255
CF:198.41.192.0-198.41.199.255
CF:198.41.192.0-198.41.223.255 CF:198.41.192.0-198.41.223.255
CF:198.41.200.0-198.41.207.255 CF:198.41.200.0-198.41.207.255
CF:198.41.208.0-198.41.209.255 CF:198.41.208.0-198.41.209.255
CF:198.41.211.0-198.41.211.255
CF:198.41.212.0-198.41.212.255 CF:198.41.212.0-198.41.212.255
CF:198.41.213.0-198.41.213.255 CF:198.41.213.0-198.41.213.255
CF:198.41.214.0-198.41.215.255 CF:198.41.214.0-198.41.215.255
@ -655,11 +893,11 @@ CF:198.41.220.0-198.41.221.255
CF:198.41.222.0-198.41.222.255 CF:198.41.222.0-198.41.222.255
CF:198.41.223.0-198.41.223.255 CF:198.41.223.0-198.41.223.255
CF:198.41.224.0-198.41.227.255 CF:198.41.224.0-198.41.227.255
CF:198.41.228.0-198.41.228.255 CF:198.41.228.0-198.41.231.255
CF:198.41.229.0-198.41.229.255 CF:198.41.229.0-198.41.229.255
CF:198.41.230.0-198.41.230.255 CF:198.41.230.0-198.41.230.255
CF:198.41.231.0-198.41.231.255 CF:198.41.231.0-198.41.231.255
CF:198.41.232.0-198.41.232.255 CF:198.41.232.0-198.41.233.255
CF:198.41.233.0-198.41.233.255 CF:198.41.233.0-198.41.233.255
CF:198.41.234.0-198.41.234.255 CF:198.41.234.0-198.41.234.255
CF:198.41.235.0-198.41.235.255 CF:198.41.235.0-198.41.235.255
@ -668,8 +906,16 @@ CF:198.41.240.0-198.41.240.255
CF:198.41.241.0-198.41.241.255 CF:198.41.241.0-198.41.241.255
CF:198.41.242.0-198.41.242.255 CF:198.41.242.0-198.41.242.255
CF:198.41.243.0-198.41.243.255 CF:198.41.243.0-198.41.243.255
CF:198.41.244.0-198.41.244.255
CF:198.41.245.0-198.41.245.255
CF:198.41.246.0-198.41.247.255 CF:198.41.246.0-198.41.247.255
CF:198.41.248.0-198.41.249.255 CF:198.41.248.0-198.41.249.255
CF:198.41.250.0-198.41.250.255 CF:198.41.250.0-198.41.250.255
CF:198.41.252.0-198.41.252.255 CF:198.41.252.0-198.41.252.255
CF:198.41.254.0-198.41.254.255
CF:198.41.255.0-198.41.255.255
CF:198.217.251.0-198.217.251.255
CF:199.21.96.0-199.21.99.255
CF:199.27.132.0-199.27.132.255 CF:199.27.132.0-199.27.132.255
CF:199.60.103.0-199.60.103.255
CF:207.189.149.0-207.189.149.255

View File

@ -0,0 +1,6 @@
### PGListUtil
This tool is useful to convert `CIDR list` to `Range format`, or remove unnecessary lines (such as duplicated ranges) automatically.
The software was released in the [year 2010](https://live28.5ch.net/test/read.cgi/download/1268903774/10).
Original author said: `You are free to modify or redistribute the source code`

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,10 @@
### Original files
- [PGListUtil.exe](https://codeberg.org/crimeflare/cloudflare-tor/raw/branch/master/tool/PGListUtil/releases/PGListUtil.exe)
- [readme.txt](readme.txt)
### English
- [PGListUtil_en.exe](https://codeberg.org/crimeflare/cloudflare-tor/raw/branch/master/tool/PGListUtil/releases/PGListUtil_en.exe)

View File

@ -0,0 +1,138 @@
PeerGuardian向けに作られたテキスト形式のリストファイルを
条件に合わせて新しいファイルに出力することができます
複数のリストファイルをひとつにまとめて出力することもできます
===================================================================================
コマンドライン引数にファイルパスを指定して起動すると、自動的に入力ファイルパスに追加できます
複数のパス指定に対応しています
コマンドに関しては「送る(SendTo)」にショートカットを作成して使用することを想定しています
(お手数ですが手動で作成してください)
リストファイルで1行のサイズが1024バイトを超えると正確な構文解析ができません
設定はどこにも保存しないのでアンインストールする場合はそのまま削除で問題ありません
ソースコードの改変や転載等は自由に行ってくれても構いません
当ソフトの使用はあくまで自己責任でお願いします
動作環境は(確認していませんが)Windows 2000以降のWindows NT系OS
動作確認はWindodws XP SP3でのみ行っています
===================================================================================
主な機能
・キャプションフィルター
大文字と小文字は区別しません
除外にチェックを入れると、一致したものを除外して出力するようになります
言い方を変えれば一致しないものを出力するようになります
何も入力しなければこの機能は無効となります
・IPの重複を解消
デフォルトで開始IPと終了IPが一致するものを出力しません
test1:1.2.3.4-5.6.7.8
test2:1.2.3.4-5.6.7.8 → test1とtest2のどちらかは出力しません
間に含まれるものは重複の対象外として普通に出力します
test1:1.2.3.4-5.6.7.100
test2:1.2.3.4-5.6.7.10 → 事実上重複ですがtest2は出力されます
・ソート機能
キャプションとIPアドレスでリストをソートすることができます
この二つのソートは併用するとキャプション優勢のソートになります
仕様上、重複IPを解消する場合はIPアドレスでソートを有効にしたほうが使用メモリを少なく抑えられます
・保存モード
「上書き」ファイルが存在する場合、以前のファイルの内容は破棄されます
「追記」 ファイルが存在する場合、以前のファイルの終端に追記されます
いずれもファイルが存在しない場合は新しいファイルが作成されます
・チェック機能
以下のようなありがちなミスをチェックします
構文エラー
キャプションの最後に : が無い
IPアドレスに4桁以上の数字
. と , の間違い
IPアドレス間の - が無い
マスク表記されたIP(例:0.0.0.0/24)
行末の文字
不正なIPアドレス
IPアドレスに256以上の数字
開始IPが終了IPより大きい
・自動修復
チェック時に「構文エラー (自動修復可)」と出たものは、ファイル出力時に自動的に修復、展開されます
:抜け、.と,の間違い、マスク表記されたIPなど
これらに当てはまっても数値が不正であればエラーになります
他は概ねウィンドウに書かれている通りです
===================================================================================
更新履歴
ver0.7.0
自動修復機能を追加
実行メニューに「チェック後、ファイル出力」を追加 (エラーが見つかったらファイル出力を行わない)
ファイル出力時のIPアドレスのチェックを省略 (問答無用で出力するため「チェック後、ファイル出力」を推奨)
その他細かい調整
ver0.6.1
視覚スタイルを適用
入力ファイル追加ダイアログで、ドライブ直下より深いディレクトリでファイルを複数選択した場合、リストに正しく追加できなかった不具合を修正
ver0.6.0
GUIの見直し
リソースエディタをResEditに変更 (コンパイラはWindows SDK 6以降で変更なし)
(0.5.0に含まれるresファイルはVC2002で組んだものをWindows SDK 6でコンパイルしたもの)
DLL化していた機能とチェック機能をUtilに統合し、CUI版チェッカーの配布を停止
重複IP解消の可否を設定できるようにした
入力ファイルリストの選択アイテムをDeleteキーで削除できるようにした
その他細かい調整
ver0.5.0
名前をPG2ListUtilからPGListUtilに変更
Windowsネイティブに移行 (.NET Frameworkは不要になりました)
機能の一部をDLLに移行
保存モード「保存しない」を削除
構文エラーを吐かないようにした (チェックはCUI版のチェッカーを使用してください)
キャプションフィルターをANDとORに分けた (今後同時に使用できるようにする可能性もあります)
キャプションフィルターの正規表現を削除 (今後実装する可能性もあります)
AND条件の仕様を変更 (文字列が重なる部分も一致するようにした)
ファイルのドラッグ&ドロップを入力ファイルと出力ファイルに分けた

View File

@ -0,0 +1,9 @@
#include <windows.h>
#include "WindowMain.h"
#include "resource.h"
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) {
WindowMain::Init(hInstance);
DialogBox(hInstance, (LPTSTR)IDD_MAIN, NULL, (DLGPROC)(WindowMain::DlgProcMain));
return 0;
}

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="*.*.PGListUtil"
type="win32"
/>
<description>Description</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>

View File

@ -0,0 +1,6 @@
#ifndef PGLISTUTIL_H
#define PGLISTUTIL_H
extern HINSTANCE hInst;
#endif // PGLISTUTIL_H

View File

@ -0,0 +1,191 @@
#include "WindowMain.h"
#include "resource.h"
#include "../common/CErrorList.h"
#include "../common/CIpList.h"
namespace ThreadExecute {
namespace {
TCHAR g_tsTemp[STRLEN_TEMP];
TCHAR g_tsPath[STRLEN_PATH];
TCHAR g_tsFailedFileRead[STRLEN_RESULT];
TCHAR g_tsFailedFileWrite[STRLEN_RESULT];
TCHAR g_tsOutputComplete[STRLEN_RESULT];
TCHAR g_tsCheckComplete[STRLEN_RESULT];
TCHAR g_tsFoundError[STRLEN_RESULT];
TCHAR g_tsNotFoundError[STRLEN_RESULT];
TCHAR g_tsErrorSyntax[STRLEN_RESULT];
TCHAR g_tsErrorIp[STRLEN_RESULT];
TCHAR g_tsErrorSyntaxRestorable[STRLEN_RESULT];
CHAR *GetMBSfromWS(WCHAR *ws) {
int i = WideCharToMultiByte(CP_THREAD_ACP, 0, ws, -1, NULL, 0, NULL, NULL) + 1;
if(0 < i) {
CHAR *mbs = new CHAR[i];
if(!WideCharToMultiByte(CP_THREAD_ACP, 0, ws, -1, mbs, i, NULL, NULL)) {
delete[] mbs;
mbs = NULL;
}
return mbs;
} else {
return NULL;
}
}
char *ReleaseMBS(char *mbs) {
if(mbs) {
delete[] mbs;
mbs = NULL;
}
return mbs;
}
bool ExecCheckInfile(HWND hDlg) {
char *mbsPath;
int incomp = 0;
pglu::error::CErrorList errlist;
WindowMain::Edit_Result_SetText(hDlg, NULL);
int iInfileCount = WindowMain::ListView_Infile_GetItemCount(hDlg);
for(int iCountInfile = 0; iCountInfile < iInfileCount; ++iCountInfile) {
WindowMain::ListView_Infile_GetItemText(hDlg, iCountInfile, g_tsPath);
WindowMain::Edit_Result_AppendText(hDlg, g_tsPath);
mbsPath = GetMBSfromWS(g_tsPath);
if(mbsPath && errlist.LoadListFile(mbsPath)) {
int iErrCount = errlist.Count();
if(0 < iErrCount) {
WindowMain::Edit_Result_AppendText(hDlg, g_tsFoundError);
lstrcpy(g_tsTemp, TEXT("\r\n"));
for(pglu::error::CError * err = errlist.GetNext(); err; err = errlist.GetNext()) {
switch(err->kind) {
case pglu::error::SYNTAX:
wsprintf(g_tsTemp + 2, g_tsErrorSyntax, err->line);
++incomp;
break;
case pglu::error::IP:
wsprintf(g_tsTemp + 2, g_tsErrorIp, err->line);
++incomp;
break;
case pglu::error::SYNTAX_RESTORABLE:
wsprintf(g_tsTemp + 2, g_tsErrorSyntaxRestorable, err->line);
break;
}
WindowMain::Edit_Result_AppendText(hDlg, g_tsTemp);
}
} else {
WindowMain::Edit_Result_AppendText(hDlg, g_tsNotFoundError);
}
mbsPath = ReleaseMBS(mbsPath);
} else {
WindowMain::Edit_Result_AppendText(hDlg, g_tsFailedFileRead);
++incomp;
}
WindowMain::Edit_Result_AppendText(hDlg, TEXT("\r\n\r\n"));
errlist.Clear();
}
return (incomp == 0);
}
bool ExecOutput(HWND hDlg) {
bool succ = false;
char *mbsPath;
WindowMain::COption option;
pglu::ip::CIpList iplist;
// 設定取得
WindowMain::GetOption(hDlg, &option);
// フィルタ設定
WindowMain::Edit_Filter_GetText(hDlg, g_tsTemp);
if(0 < lstrlen(g_tsTemp)) {
char *mbsFilter = GetMBSfromWS(g_tsTemp);
if(mbsFilter) {
pglu::filter::EFilterMode filtMode = (option.filtAnd ? pglu::filter::AND : pglu::filter::OR);
iplist.SetFilter(mbsFilter, filtMode, option.filtDel);
mbsFilter = ReleaseMBS(mbsFilter);
}
}
// 読み込み
int iInfileCount = WindowMain::ListView_Infile_GetItemCount(hDlg);
for(int iCountInfile = 0; iCountInfile < iInfileCount; ++iCountInfile) {
WindowMain::ListView_Infile_GetItemText(hDlg, iCountInfile, g_tsPath);
mbsPath = GetMBSfromWS(g_tsPath);
if(mbsPath) {
succ = iplist.LoadListFile(mbsPath);
mbsPath = ReleaseMBS(mbsPath);
if(!succ) {
// 読み込み失敗
WindowMain::Edit_Result_SetText(hDlg, g_tsPath);
WindowMain::Edit_Result_SetText(hDlg, g_tsFailedFileRead);
return false;
}
}
}
// チェック ソート
iplist.CheckAndSort(option.sortCap, option.sortIp, option.delDupIp);
// 書き出し
WindowMain::Edit_Outfile_GetText(hDlg, g_tsPath);
mbsPath = GetMBSfromWS(g_tsPath);
if(mbsPath) {
succ = iplist.SaveListFile(mbsPath, option.saveAppend);
mbsPath = ReleaseMBS(mbsPath);
if(!succ) {
// 書き込み失敗
WindowMain::Edit_Result_SetText(hDlg, g_tsPath);
WindowMain::Edit_Result_SetText(hDlg, g_tsFailedFileWrite);
return false;
}
}
// 実行結果
int iIpCount = iplist.Count();
int iIpCountDisabled = iplist.CountDisabled();
wsprintf(g_tsTemp, g_tsOutputComplete, iIpCount, iIpCountDisabled, iIpCount - iIpCountDisabled);
WindowMain::Edit_Result_SetText(hDlg, g_tsTemp);
return true;
}
} // namespace
BOOL Init(HINSTANCE hInstance) {
LoadString(hInstance, IDS_FAILED_FILE_READ, g_tsFailedFileRead, STRLEN_RESULT);
LoadString(hInstance, IDS_FAILED_FILE_WRITE, g_tsFailedFileWrite, STRLEN_RESULT);
LoadString(hInstance, IDS_OUTPUT_COMPLETE, g_tsOutputComplete, STRLEN_RESULT);
LoadString(hInstance, IDS_CHECK_COMPLETE, g_tsCheckComplete, STRLEN_RESULT);
LoadString(hInstance, IDS_CHECK_FOUND_ERROR, g_tsFoundError, STRLEN_RESULT);
LoadString(hInstance, IDS_CHECK_NOTFOUND_ERROR, g_tsNotFoundError, STRLEN_RESULT);
LoadString(hInstance, IDS_CHECK_ERROR_SYNTAX, g_tsErrorSyntax, STRLEN_RESULT);
LoadString(hInstance, IDS_CHECK_ERROR_IP, g_tsErrorIp, STRLEN_RESULT);
LoadString(hInstance, IDS_CHECK_ERROR_SYNTAX_RESTORABLE, g_tsErrorSyntaxRestorable, STRLEN_RESULT);
return TRUE;
}
DWORD WINAPI ThreadExecCheckInfile(LPVOID lpParam) {
HWND hDlg = (HWND)lpParam;
ExecCheckInfile(hDlg);
WindowMain::Dlg_Executing(hDlg, FALSE);
ExitThread(TRUE);
}
DWORD WINAPI ThreadExecOutput(LPVOID lpParam) {
HWND hDlg = (HWND)lpParam;
ExecOutput(hDlg);
WindowMain::Dlg_Executing(hDlg, FALSE);
ExitThread(TRUE);
}
DWORD WINAPI ThreadExecCheckAndOutput(LPVOID lpParam) {
HWND hDlg = (HWND)lpParam;
if(ExecCheckInfile(hDlg))
ExecOutput(hDlg);
WindowMain::Dlg_Executing(hDlg, FALSE);
ExitThread(TRUE);
}
} // namespace ThreadExecute

View File

@ -0,0 +1,16 @@
#ifndef THREADEXECUTE_H
#define THREADEXECUTE_H
#include <windows.h>
namespace ThreadExecute {
BOOL Init(HINSTANCE hInstance);
DWORD WINAPI ThreadExecCheckInfile(LPVOID);
DWORD WINAPI ThreadExecOutput(LPVOID);
DWORD WINAPI ThreadExecCheckAndOutput(LPVOID);
}
#endif // THREADEXECUTE_H

View File

@ -0,0 +1,440 @@
#include "stdafx.h"
#include "WindowMain.h"
#include "resource.h"
#include "ThreadExecute.h"
#define WM_USER_EXECUTING WM_USER
namespace WindowMain {
namespace {
TCHAR g_tsTempA[STRLEN_TEMP];
TCHAR g_tsTempB[STRLEN_TEMP];
HINSTANCE g_hInst;
OPENFILENAME g_ofn = { 0 };
TCHAR g_tsExpFilt[STRLEN_EXPFILT];
TCHAR g_tsPath[STRLEN_PATH];
MENUITEMINFO g_mii = { 0 };
TCHAR g_tsSetInfile[STRLEN_RESULT];
TCHAR g_tsSetOutfile[STRLEN_RESULT];
TCHAR g_tsExecuting[STRLEN_RESULT];
WNDPROC WndProcListInfileDef;
WNDPROC WndProcEditOutfileDef;
//--------------------------------------
// Function
//--------------------------------------
void Menu_SwapIfChecked(HMENU hMenuMain, int nItemSrc, int nItemCmp) {
GetMenuItemInfo(hMenuMain, nItemCmp, FALSE, &g_mii);
if(g_mii.fState & MFS_CHECKED) {
g_mii.fState = MFS_CHECKED;
SetMenuItemInfo(hMenuMain, nItemSrc, FALSE, &g_mii);
g_mii.fState = MFS_UNCHECKED;
SetMenuItemInfo(hMenuMain, nItemCmp, FALSE, &g_mii);
}
}
void ListView_Infile_AddItem(HWND hListInfile, LPTSTR tsPath, LPTSTR tsFile) {
LVITEM lvItem = { 0 };
lvItem.mask = LVIF_TEXT;
lvItem.iSubItem = 0;
lvItem.pszText = tsPath;
lvItem.iItem = ListView_InsertItem(hListInfile, &lvItem);
lvItem.iSubItem = 1;
lvItem.pszText = tsFile;
ListView_SetItem(hListInfile, &lvItem);
}
void ListView_Infile_AddItem(HWND hListInfile, LPTSTR tsPath) {
LPTSTR tsFile = tsPath;
for(LPTSTR tsP = tsFile; *tsP != TEXT('\0'); ++tsP)
if(*tsP == TEXT('\\'))
tsFile = tsP;
ListView_Infile_AddItem(hListInfile, tsPath, tsFile + 1);
}
void ListView_Infile_DelSelItem(HWND hListInfile) {
int i = -1;
int j = -1;
while((i = ListView_GetNextItem(hListInfile, i, LVNI_SELECTED)) != -1) {
j = i;
ListView_DeleteItem(hListInfile, i--);
}
if(j != -1) {
if(0 < (i = ListView_GetItemCount(hListInfile))) {
if(j < i) {
ListView_SetItemState(hListInfile, j, LVIS_SELECTED, LVIS_SELECTED);
} else {
ListView_SetItemState(hListInfile, i - 1, LVIS_SELECTED, LVIS_SELECTED);
}
}
}
}
void ListView_Infile_DelDup(HWND hListInfile) {
int i = ListView_GetItemCount(hListInfile);
if(1 < i) {
for(--i; 0 < i; --i) {
ListView_GetItemText(hListInfile, i, 0, g_tsTempA, STRLEN_TEMP);
ListView_GetItemText(hListInfile, i - 1, 0, g_tsTempB, STRLEN_TEMP);
if(lstrcmpi(g_tsTempA, g_tsTempB) == 0)
ListView_DeleteItem(hListInfile, i);
}
}
}
BOOL IsEmptyInfile(HWND hListInfile, HWND hEditResult) {
if(ListView_GetItemCount(hListInfile) < 1) {
SetWindowText(hEditResult, g_tsSetInfile);
return TRUE;
}
return FALSE;
}
BOOL IsEmptyOutfile(HWND hEditOutfile, HWND hEditResult) {
if(GetWindowTextLength(hEditOutfile) < 1) {
SetWindowText(hEditResult, g_tsSetOutfile);
return TRUE;
}
return FALSE;
}
//--------------------------------------
// Sub Window Procedure
//--------------------------------------
LRESULT WndProcListInfileSub(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
int i, j;
switch(msg) {
case WM_KEYDOWN: {
if(wp == VK_DELETE)
ListView_Infile_DelSelItem(hWnd);
} break;
case WM_DROPFILES: {
j = DragQueryFile((HDROP)wp, -1, NULL, 0);
for(i = 0; i < j; ++i) {
DragQueryFile((HDROP)wp, i, g_tsTempA, STRLEN_TEMP);
ListView_Infile_AddItem(hWnd, g_tsTempA);
}
ListView_Infile_DelDup(hWnd);
} break;
default:
return CallWindowProc(WndProcListInfileDef, hWnd, msg, wp, lp);
}
return 0;
}
LRESULT WndProcEditOutfileSub(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
switch(msg) {
case WM_DROPFILES: {
DragQueryFile((HDROP)wp, 0, g_tsTempA, STRLEN_TEMP);
SetWindowText(hWnd, g_tsTempA);
} break;
default:
return CallWindowProc(WndProcEditOutfileDef, hWnd, msg, wp, lp);
}
return 0;
}
} // namespace
//--------------------------------------
// WindowMain
//--------------------------------------
BOOL Init(HINSTANCE hInstance) {
InitCommonControls();
g_hInst = hInstance;
// 文字列読み込み
LoadString(hInstance, IDS_SET_INFILE, g_tsSetInfile, STRLEN_RESULT);
LoadString(hInstance, IDS_SET_OUTFILE, g_tsSetOutfile, STRLEN_RESULT);
LoadString(hInstance, IDS_EXECUTING, g_tsExecuting, STRLEN_RESULT);
LoadString(hInstance, IDS_EXPFILT_PGLIST, g_tsExpFilt, STRLEN_EXPFILT);
// g_tsExpFiltは@をnull文字に変換
for(TCHAR *p = g_tsExpFilt; *p != TEXT('\0'); ++p)
if(*p == TEXT('@'))
*p = TEXT('\0');
// MENUITEMINFO設定
g_mii.cbSize = sizeof(g_mii);
g_mii.fMask = MIIM_STATE;
// OPENFILENAME設定
g_ofn.lStructSize = sizeof(g_ofn);
g_ofn.lpstrFilter = g_tsExpFilt;
g_ofn.nFilterIndex = 0;
g_ofn.lpstrFile = g_tsPath;
g_ofn.nMaxFile = STRLEN_PATH;
// 実行スレッド初期化
ThreadExecute::Init(hInstance);
return TRUE;
}
void Dlg_Executing(HWND hDlg, BOOL bExec) {
SendMessage(hDlg, WM_USER_EXECUTING, (WPARAM)bExec, 0);
}
int ListView_Infile_GetItemCount(HWND hDlg) {
return ListView_GetItemCount(GetDlgItem(hDlg, IDC_LISTVIEW_INFILE));
}
BOOL ListView_Infile_GetItemText(HWND hDlg, int nItem, LPTSTR tsPath) {
ListView_GetItemText(GetDlgItem(hDlg, IDC_LISTVIEW_INFILE), nItem, 0, tsPath, STRLEN_PATH);
return TRUE;
}
BOOL Edit_Outfile_GetText(HWND hDlg, LPTSTR tsPath) {
return GetDlgItemText(hDlg, IDC_EDIT_OUTFILE, tsPath, STRLEN_PATH);
}
BOOL Edit_Filter_GetText(HWND hDlg, LPTSTR tsText) {
return GetDlgItemText(hDlg, IDC_EDIT_FILTER, tsText, STRLEN_PATH);
}
void Edit_Result_SetText(HWND hDlg, LPCTSTR tsText) {
SetDlgItemText(hDlg, IDC_EDIT_RESULT, tsText);
}
BOOL GetOption(HWND hDlg, COption *option) {
HMENU hMenuMain = GetMenu(hDlg);
GetMenuItemInfo(hMenuMain, IDM_SORT_CAPTION, FALSE, &g_mii);
option->sortCap = ((g_mii.fState & MFS_CHECKED) != 0);
GetMenuItemInfo(hMenuMain, IDM_SORT_IP, FALSE, &g_mii);
option->sortIp = ((g_mii.fState & MFS_CHECKED) != 0);
GetMenuItemInfo(hMenuMain, IDM_CHECK_DUP_IP, FALSE, &g_mii);
option->delDupIp = ((g_mii.fState & MFS_CHECKED) != 0);
GetMenuItemInfo(hMenuMain, IDM_SAVE_APPEND, FALSE, &g_mii);
option->saveAppend = ((g_mii.fState & MFS_CHECKED) != 0);
option->filtAnd = (SendDlgItemMessage(hDlg, IDC_RADIO_FILTER_AND, BM_GETCHECK, 0, 0) == BST_CHECKED);
option->filtDel = (SendDlgItemMessage(hDlg, IDC_CHECK_FILTER_DEL, BM_GETCHECK, 0, 0) == BST_CHECKED);
return TRUE;
}
void Edit_Result_AppendText(HWND hDlg, LPCTSTR tsText) {
HWND hEditResult = GetDlgItem(hDlg, IDC_EDIT_RESULT);
int len = GetWindowTextLength(hEditResult);
SendMessage(hEditResult, EM_SETSEL, (WPARAM)len, (LPARAM)len);
SendMessage(hEditResult, EM_REPLACESEL, 0, (LPARAM)tsText);
}
BOOL CALLBACK DlgProcMain(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
static HMENU hMenuMain;
static HWND hListInfile;
static HWND hEditOutfile;
static HWND hEditFilter;
static HWND hEditResult;
static DWORD dwThreadId;
int i, j;
switch(msg) {
case WM_CLOSE: {
EndDialog(hWnd, 0);
} break;
case WM_INITDIALOG: {
HDC hDC;
RECT rect;
LVCOLUMN lvCol;
// 各ハンドル格納
hMenuMain = GetMenu(hWnd);
hListInfile = GetDlgItem(hWnd, IDC_LISTVIEW_INFILE);
hEditOutfile = GetDlgItem(hWnd, IDC_EDIT_OUTFILE);
hEditFilter = GetDlgItem(hWnd, IDC_EDIT_FILTER);
hEditResult = GetDlgItem(hWnd, IDC_EDIT_RESULT);
// ウィンドウ位置設定
hDC = GetDC(hWnd);
GetWindowRect(hWnd, &rect);
SetWindowPos(hWnd, HWND_TOP,
(GetDeviceCaps(hDC, HORZRES) - (rect.right - rect.left)) / 2,
(GetDeviceCaps(hDC, VERTRES) - (rect.bottom - rect.top)) / 2,
0, 0, SWP_NOSIZE);
ReleaseDC(hWnd, hDC);
// リストビュー設定
ListView_SetExtendedListViewStyle(hListInfile,
LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_LABELTIP);//LVS_EX_INFOTIP);
int nWidthScroll = GetSystemMetrics(SM_CXVSCROLL);
int nWidth3DEdge = GetSystemMetrics(SM_CXEDGE);
GetWindowRect(hListInfile, &rect);
lvCol.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
lvCol.fmt = LVCFMT_LEFT;
lvCol.cx = 72;
lvCol.iSubItem = 0;
LoadString(g_hInst, IDS_FILE_PATH, g_tsTempA, STRLEN_TEMP);
lvCol.pszText = g_tsTempA;
ListView_InsertColumn(hListInfile, 0, &lvCol);
lvCol.cx = (rect.right - rect.left) - 72 - nWidthScroll - nWidth3DEdge * 2;
lvCol.iSubItem = 1;
LoadString(g_hInst, IDS_FILE_NAME, g_tsTempA, STRLEN_TEMP);
lvCol.pszText = g_tsTempA;
ListView_InsertColumn(hListInfile, 1, &lvCol);
// チェック状態
SendDlgItemMessage(hWnd, IDC_RADIO_FILTER_AND, BM_SETCHECK, BST_CHECKED, 0);
#ifdef UNICODE
// コマンドライン引数からリストへ追加
LPWSTR *wsCmds = CommandLineToArgvW(GetCommandLineW(), &j);
for(i = 1; i < j; ++i)
ListView_Infile_AddItem(hListInfile, wsCmds[i]);
LocalFree((HLOCAL)wsCmds);
ListView_Infile_DelDup(hListInfile);
#endif
// サブクラス
WndProcListInfileDef = (WNDPROC)GetWindowLong(hListInfile, GWL_WNDPROC);
SetWindowLong(hListInfile, GWL_WNDPROC, (LONG)WndProcListInfileSub);
WndProcEditOutfileDef = (WNDPROC)GetWindowLong(hEditOutfile, GWL_WNDPROC);
SetWindowLong(hEditOutfile, GWL_WNDPROC, (LONG)WndProcEditOutfileSub);
} break;
case WM_COMMAND: {
switch(LOWORD(wp)) {
case IDM_EXIT: {
EndDialog(hWnd, IDOK);
//PostMessage(hWnd, WM_CLOSE, 0, 0);
} break;
case IDM_SORT_CAPTION:
case IDM_SORT_IP:
case IDM_CHECK_DUP_IP: {
GetMenuItemInfo(hMenuMain, LOWORD(wp), FALSE, &g_mii);
g_mii.fState = ((g_mii.fState & MFS_CHECKED) ? MFS_UNCHECKED : MFS_CHECKED);
SetMenuItemInfo(hMenuMain, LOWORD(wp), FALSE, &g_mii);
} break;
case IDM_SAVE_REPLACE: {
Menu_SwapIfChecked(hMenuMain, IDM_SAVE_REPLACE, IDM_SAVE_APPEND);
} break;
case IDM_SAVE_APPEND: {
Menu_SwapIfChecked(hMenuMain, IDM_SAVE_APPEND, IDM_SAVE_REPLACE);
} break;
case IDM_CHECK_INFILE: {
if(IsEmptyInfile(hListInfile, hEditResult))
break;
SendMessage(hWnd, WM_USER_EXECUTING, (WPARAM)TRUE, 0);
CreateThread(NULL, 0, ThreadExecute::ThreadExecCheckInfile, (LPVOID)hWnd, 0, &dwThreadId);
} break;
case IDM_OUTPUT: {
if(IsEmptyInfile(hListInfile, hEditResult) || IsEmptyOutfile(hEditOutfile, hEditResult))
break;
SendMessage(hWnd, WM_USER_EXECUTING, (WPARAM)TRUE, 0);
CreateThread(NULL, 0, ThreadExecute::ThreadExecOutput, (LPVOID)hWnd, 0, &dwThreadId);
} break;
case IDM_CHECK_AND_OUTPUT: {
if(IsEmptyInfile(hListInfile, hEditResult) || IsEmptyOutfile(hEditOutfile, hEditResult))
break;
SendMessage(hWnd, WM_USER_EXECUTING, (WPARAM)TRUE, 0);
CreateThread(NULL, 0, ThreadExecute::ThreadExecCheckAndOutput, (LPVOID)hWnd, 0, &dwThreadId);
} break;
case IDC_BUTTON_INFILE_ADD: {
// C:\a.txt0
// C:\0a.txt0b.txt00
// C:\dir0a.txt0b.txt00
memset(g_tsPath, 0, STRLEN_PATH);
g_ofn.hwndOwner = hWnd;
g_ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT | OFN_HIDEREADONLY;
if(GetOpenFileName(&g_ofn)) {
if(g_tsPath[g_ofn.nFileOffset - 1] != TEXT('\0'))
ListView_Infile_AddItem(hListInfile, g_tsPath, g_tsPath + g_ofn.nFileOffset);
else {
lstrcpy(g_tsTempA, g_tsPath);
LPTSTR tsFile = g_tsTempA + g_ofn.nFileOffset - 1;
if(*(tsFile - 1) != TEXT('\\')) {
*tsFile = TEXT('\\');
++tsFile;
}
for(LPTSTR tsP = g_tsPath + g_ofn.nFileOffset; *tsP != TEXT('\0'); ++tsP) {
lstrcpy(tsFile, tsP);
ListView_Infile_AddItem(hListInfile, g_tsTempA, tsFile);
while(*tsP != TEXT('\0'))
++tsP;
}
}
ListView_Infile_DelDup(hListInfile);
}
} break;
case IDC_BUTTON_INFILE_DEL: {
ListView_Infile_DelSelItem(hListInfile);
} break;
case IDC_BUTTON_INFILE_CLEAR: {
ListView_DeleteAllItems(hListInfile);
} break;
case IDC_BUTTON_OUTFILE_REF: {
memset(g_tsPath, 0, STRLEN_PATH);
g_ofn.hwndOwner = hWnd;
g_ofn.Flags = OFN_EXPLORER;
if(GetSaveFileName(&g_ofn))
SetWindowText(hEditOutfile, g_tsPath);
} break;
case IDC_BUTTON_FILTER_CLEAR: {
SetWindowText(hEditFilter, NULL);
} break;
default:
return FALSE;
}
} break;
case WM_USER_EXECUTING: {
if((BOOL)wp) {
g_mii.fState = MFS_GRAYED;
SetWindowText(hEditResult, g_tsExecuting);
} else {
g_mii.fState = MFS_ENABLED;
}
SetMenuItemInfo(hMenuMain, 2, TRUE, &g_mii);
DrawMenuBar(hWnd);
} break;
default:
return FALSE;
}
return TRUE;
}
} // namespace WindowMain

View File

@ -0,0 +1,39 @@
#ifndef WINDOWMAIN_H
#define WINDOWMAIN_H
#include <windows.h>
#define STRLEN_TEMP 1024
#define STRLEN_PATH 1024
#define STRLEN_EXPFILT 128
#define STRLEN_RESULT 64
namespace WindowMain {
struct COption {
bool sortCap;
bool sortIp;
bool delDupIp;
bool saveAppend;
bool filtAnd;
bool filtDel;
};
BOOL Init(HINSTANCE hInstance);
BOOL CALLBACK DlgProcMain(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
void Dlg_Executing(HWND hDlg, BOOL bExec);
int ListView_Infile_GetItemCount(HWND hDlg);
BOOL ListView_Infile_GetItemText(HWND hDlg, int nItem, LPTSTR tsPath);
BOOL Edit_Outfile_GetText(HWND hDlg, LPTSTR tsPath);
BOOL Edit_Filter_GetText(HWND hDlg, LPTSTR tsText);
BOOL GetOption(HWND hDlg, COption *option);
void Edit_Result_SetText(HWND hDlg, LPCTSTR tsText);
void Edit_Result_AppendText(HWND hDlg, LPCTSTR tsText);
}
#endif // WINDOWMAIN_H

View File

@ -0,0 +1,42 @@
#ifndef IDC_STATIC
#define IDC_STATIC (-1)
#endif
#define IDC_EDIT_FILTER 1001
#define IDC_LISTVIEW_INFILE 1002
#define IDC_BUTTON_INFILE_ADD 1004
#define IDD_MAIN 1041
#define IDR_MENU_MAIN 1041
#define IDM_EXIT 40000
#define IDS_SET_INFILE 40000
#define IDM_SORT_CAPTION 40001
#define IDS_SET_OUTFILE 40001
#define IDM_SORT_IP 40002
#define IDS_FAILED_FILE_READ 40002
#define IDM_CHECK_DUP_IP 40003
#define IDS_FAILED_FILE_WRITE 40003
#define IDM_SAVE_REPLACE 40004
#define IDS_FILE_PATH 40004
#define IDM_SAVE_APPEND 40005
#define IDS_FILE_NAME 40005
#define IDM_CHECK_INFILE 40006
#define IDS_EXPFILT_PGLIST 40006
#define IDM_OUTPUT 40007
#define IDS_OUTPUT_COMPLETE 40007
#define IDM_CHECK_AND_OUTPUT 40008
#define IDS_EXECUTING 40008
#define IDS_CHECK_FOUND_ERROR 40009
#define IDS_CHECK_NOTFOUND_ERROR 40010
#define IDS_CHECK_COMPLETE 40011
#define IDS_CHECK_ERROR_SYNTAX 40012
#define IDS_CHECK_ERROR_IP 40013
#define IDS_CHECK_ERROR_SYNTAX_RESTORABLE 40014
#define IDC_EDIT_OUTFILE 40022
#define IDC_EDIT_RESULT 40026
#define IDC_BUTTON_INFILE_DEL 40027
#define IDC_BUTTON_INFILE_CLEAR 40028
#define IDC_BUTTON_OUTFILE_REF 40029
#define IDC_BUTTON_FILTER_CLEAR 40030
#define IDC_RADIO_FILTER_AND 40031
#define IDC_RADIO_FILTER_OR 40032
#define IDC_CHECK_FILTER_DEL 40033

View File

@ -0,0 +1,100 @@
// Generated by ResEdit 1.4.4.18
// Copyright (C) 2006-2008
// http://www.resedit.net
#include "resource.h"
#include <windows.h>
#include <commctrl.h>
#include <richedit.h>
//
// Menu resources
//
IDR_MENU_MAIN MENU
{
POPUP "ファイル(&F)"
{
MENUITEM "終了(&X)", IDM_EXIT
}
POPUP "設定(&O)"
{
MENUITEM "キャプションでソート(&C)", IDM_SORT_CAPTION, CHECKED
MENUITEM "IPアドレスでソート(&I)", IDM_SORT_IP, CHECKED
MENUITEM SEPARATOR
MENUITEM "IPアドレスの重複を解消(&D)", IDM_CHECK_DUP_IP, CHECKED
MENUITEM SEPARATOR
MENUITEM "上書き保存(&R)", IDM_SAVE_REPLACE, CHECKED
MENUITEM "追記保存(&A)", IDM_SAVE_APPEND
}
POPUP "実行(&E)"
{
MENUITEM "入力ファイルをチェック(&C)", IDM_CHECK_INFILE
MENUITEM SEPARATOR
MENUITEM "ファイル出力(&O)", IDM_OUTPUT
MENUITEM SEPARATOR
MENUITEM "チェック後、ファイル出力(&S)", IDM_CHECK_AND_OUTPUT
}
}
//
// Dialog resources
//
IDD_MAIN DIALOGEX 0, 0, 334, 228
STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_GROUP | WS_POPUP | WS_SYSMENU
EXSTYLE WS_EX_OVERLAPPEDWINDOW
CAPTION "PGListUtil ver0.7.0"
MENU IDR_MENU_MAIN
FONT 9, "MS UI Gothic", 400, 0, 128
{
CONTROL "", IDC_LISTVIEW_INFILE, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_ALIGNLEFT | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | LVS_REPORT | LVS_SORTASCENDING, 6, 16, 158, 118, WS_EX_ACCEPTFILES
PUSHBUTTON "追加", IDC_BUTTON_INFILE_ADD, 62, 138, 30, 16, BS_PUSHBUTTON
PUSHBUTTON "削除", IDC_BUTTON_INFILE_DEL, 98, 138, 30, 16, BS_PUSHBUTTON
PUSHBUTTON "クリア", IDC_BUTTON_INFILE_CLEAR, 134, 138, 30, 16, BS_PUSHBUTTON
EDITTEXT IDC_EDIT_OUTFILE, 6, 168, 122, 14, ES_AUTOHSCROLL, WS_EX_ACCEPTFILES
PUSHBUTTON "参照", IDC_BUTTON_OUTFILE_REF, 134, 167, 30, 16, BS_PUSHBUTTON
EDITTEXT IDC_EDIT_FILTER, 6, 196, 122, 14, ES_AUTOHSCROLL
PUSHBUTTON "クリア", IDC_BUTTON_FILTER_CLEAR, 134, 195, 30, 16, BS_PUSHBUTTON
AUTORADIOBUTTON "AND", IDC_RADIO_FILTER_AND, 6, 212, 26, 10, WS_GROUP | WS_TABSTOP | BS_AUTORADIOBUTTON
AUTORADIOBUTTON "OR", IDC_RADIO_FILTER_OR, 34, 212, 26, 10, WS_TABSTOP | BS_AUTORADIOBUTTON
AUTOCHECKBOX "除外", IDC_CHECK_FILTER_DEL, 102, 212, 26, 10, BS_AUTOCHECKBOX
EDITTEXT IDC_EDIT_RESULT, 170, 16, 158, 206, WS_VSCROLL | ES_MULTILINE | ES_READONLY
LTEXT "入力ファイルリスト", IDC_STATIC, 6, 6, 48, 8, SS_LEFT
LTEXT "出力ファイル", IDC_STATIC, 6, 158, 34, 8, SS_LEFT
LTEXT "キャプションフィルター", IDC_STATIC, 6, 186, 55, 8, SS_LEFT
LTEXT "実行結果", IDC_STATIC, 170, 6, 28, 8, SS_LEFT
}
//
// String Table resources
//
STRINGTABLE
{
IDS_SET_INFILE "入力ファイルを設定してください"
IDS_SET_OUTFILE "出力ファイルを設定してください"
IDS_FAILED_FILE_READ " の読み込みに失敗しました"
IDS_FAILED_FILE_WRITE " の書き込みに失敗しました"
IDS_FILE_PATH "ファイルパス"
IDS_FILE_NAME "ファイル名"
IDS_EXPFILT_PGLIST "テキストファイル (*.txt)@*.txt@すべてのファイル (*.*)@*.*@@"
IDS_OUTPUT_COMPLETE "ファイル出力が完了しました\r\n\r\n入力数 = %d\r\n無効数 = %d\r\n出力数 = %d\r\n"
IDS_EXECUTING "実行中..."
IDS_CHECK_FOUND_ERROR " に以下のエラーが見つかりました"
IDS_CHECK_NOTFOUND_ERROR " に想定内のエラーは見つかりませんでした"
IDS_CHECK_COMPLETE "チェックが完了しました"
IDS_CHECK_ERROR_SYNTAX "[ %d 行目 ] 構文エラー"
IDS_CHECK_ERROR_IP "[ %d 行目 ] 不正なIPアドレス"
IDS_CHECK_ERROR_SYNTAX_RESTORABLE "[ %d 行目 ] 構文エラー (自動修復可)"
}
//
// Manifest resources
//
1 RT_MANIFEST ".\\PGListUtil.exe.manifest"

View File

@ -0,0 +1,12 @@
#ifndef PGLU_STDAFX_H
#define PGLU_STDAFX_H
#include <windows.h>
#ifdef __MINGW32__
#define _WIN32_IE 0x0600
#endif
#include <commctrl.h>
#endif // PGLU_STDAFX_H

View File

@ -0,0 +1,171 @@
#include <stdio.h>
#include <boost/xpressive/xpressive.hpp>
#include "CErrorList.h"
namespace pglu {
namespace error {
CErrorList::CErrorList() :
m_pool(sizeof(CError)),
m_errFoot(&m_errHead),
m_errNext(&m_errHead),
m_count(0)
{
m_errHead.line = 0;
m_errHead.kind = SYNTAX;
m_errHead.next = NULL;
}
CErrorList::~CErrorList() {
Clear();
}
void CErrorList::Clear() {
m_pool.purge_memory();
m_errHead.next = NULL;
m_errFoot = &m_errHead;
m_errNext = &m_errHead;
m_count = 0;
}
bool CErrorList::LoadListFile(const char *path) {
char buf[PGLU_LENGTH_FILELINE];
uint ip_begin1, ip_begin2, ip_begin3, ip_begin4;
uint ip_end1, ip_end2, ip_end3, ip_end4;
FILE *fp;
CError *err = m_errFoot;
using namespace boost::xpressive;
static cmatch match;
static mark_tag tagIp1(1), tagIp2(2), tagIp3(3), tagIp4(4), tagIp5(5), tagIp6(6), tagIp7(7), tagIp8(8);
static mark_tag tagSep(9), tagMask(10);
static cregex reSyntax =
as_xpr(':') >> *_s >>
(tagIp1 = repeat<1, 3>(_d)) >> as_xpr('.') >>
(tagIp2 = repeat<1, 3>(_d)) >> as_xpr('.') >>
(tagIp3 = repeat<1, 3>(_d)) >> as_xpr('.') >>
(tagIp4 = repeat<1, 3>(_d)) >>
*_s >> as_xpr('-') >> *_s >>
(tagIp5 = repeat<1, 3>(_d)) >> as_xpr('.') >>
(tagIp6 = repeat<1, 3>(_d)) >> as_xpr('.') >>
(tagIp7 = repeat<1, 3>(_d)) >> as_xpr('.') >>
(tagIp8 = repeat<1, 3>(_d)) >>
*_s >> (_ln | eos);
static cregex reSyntaxRestorable =
(tagIp1 = repeat<1, 3>(_d)) >> (set = '.', ',') >>
(tagIp2 = repeat<1, 3>(_d)) >> (set = '.', ',') >>
(tagIp3 = repeat<1, 3>(_d)) >> (set = '.', ',') >>
(tagIp4 = repeat<1, 3>(_d)) >> *_s >> (
(tagSep = +as_xpr('-')) >> *_s >>
(tagIp5 = repeat<1, 3>(_d)) >> (set = '.', ',') >>
(tagIp6 = repeat<1, 3>(_d)) >> (set = '.', ',') >>
(tagIp7 = repeat<1, 3>(_d)) >> (set = '.', ',') >>
(tagIp8 = repeat<1, 3>(_d))
|
(tagSep = +(set = '/', '\\')) >> *_s >>
(tagMask = repeat<1, 2>(_d))
) >> *_s >> (_ln | eos);
#define reIpError repeat<3>(+_d >> *_s >> (set = '.', ',') >> *_s) >> +_d
static cregex reSyntaxError =
reIpError >> *_s >> (
*as_xpr('-') >> *_s >> reIpError |
+(set = '/', '\\') >> *_s >> +_d
);
fp = fopen(path, "r");
if(fp == NULL)
return false;
for(int line = 1; fgets(buf, PGLU_LENGTH_FILELINE, fp); ++line) {
if(regex_search(buf, match, reSyntax)) {
if(!(
(ip_begin1 = ParseDigit3(match[1].first, match[1].second)) < 256 &&
(ip_begin2 = ParseDigit3(match[2].first, match[2].second)) < 256 &&
(ip_begin3 = ParseDigit3(match[3].first, match[3].second)) < 256 &&
(ip_begin4 = ParseDigit3(match[4].first, match[4].second)) < 256 &&
(ip_end1 = ParseDigit3(match[5].first, match[5].second)) < 256 &&
(ip_end2 = ParseDigit3(match[6].first, match[6].second)) < 256 &&
(ip_end3 = ParseDigit3(match[7].first, match[7].second)) < 256 &&
(ip_end4 = ParseDigit3(match[8].first, match[8].second)) < 256 &&
(uint)((ip_begin1 << 24) | (ip_begin2 << 16) | (ip_begin3 << 8) | ip_begin4) <=
(uint)((ip_end1 << 24) | (ip_end2 << 16) | (ip_end3 << 8) | ip_end4)
)) {
++m_count;
err->next = (CError*)m_pool.malloc();
err = err->next;
err->line = line;
err->kind = IP;
}
} else if(regex_search(buf, match, reSyntaxRestorable)) {
++m_count;
err->next = (CError*)m_pool.malloc();
err = err->next;
err->line = line;
if(*(match[9].first) == '-') {
if(
(ip_begin1 = ParseDigit3(match[1].first, match[1].second)) < 256 &&
(ip_begin2 = ParseDigit3(match[2].first, match[2].second)) < 256 &&
(ip_begin3 = ParseDigit3(match[3].first, match[3].second)) < 256 &&
(ip_begin4 = ParseDigit3(match[4].first, match[4].second)) < 256 &&
(ip_end1 = ParseDigit3(match[5].first, match[5].second)) < 256 &&
(ip_end2 = ParseDigit3(match[6].first, match[6].second)) < 256 &&
(ip_end3 = ParseDigit3(match[7].first, match[7].second)) < 256 &&
(ip_end4 = ParseDigit3(match[8].first, match[8].second)) < 256 &&
(uint)((ip_begin1 << 24) | (ip_begin2 << 16) | (ip_begin3 << 8) | ip_begin4) <=
(uint)((ip_end1 << 24) | (ip_end2 << 16) | (ip_end3 << 8) | ip_end4)
) {
err->kind = SYNTAX_RESTORABLE;
} else {
err->kind = SYNTAX;
}
} else {
uint mask = ParseDigit3(match[10].first, match[10].second);
if(
ParseDigit3(match[1].first, match[1].second) < 256 &&
ParseDigit3(match[2].first, match[2].second) < 256 &&
ParseDigit3(match[3].first, match[3].second) < 256 &&
ParseDigit3(match[4].first, match[4].second) < 256 &&
mask < 33
) {
err->kind = SYNTAX_RESTORABLE;
} else {
err->kind = SYNTAX;
}
}
} else if(regex_search(buf, reSyntaxError)) {
++m_count;
err->next = (CError*)m_pool.malloc();
err = err->next;
err->line = line;
err->kind = SYNTAX;
}
#ifdef __MINGW32__
ZeroString(buf);
#endif
}
fclose(fp);
err->next = NULL;
m_errFoot = err;
return true;
}
int CErrorList::Count() {
return m_count;
}
CError * CErrorList::GetNext() {
if(m_errNext)
m_errNext = m_errNext->next;
return m_errNext;
}
} // namespace error
} // namespace pglu

View File

@ -0,0 +1,43 @@
#ifndef CERRLIST_H
#define CERRLIST_H
#include <boost/pool/pool.hpp>
#include "common.h"
namespace pglu {
namespace error {
typedef enum _EErrKind {
SYNTAX,
IP,
SYNTAX_RESTORABLE
} EErrKind;
typedef struct _CError {
int line;
EErrKind kind;
_CError * next;
} CError;
class CErrorList {
private:
boost::pool<> m_pool;
CError m_errHead;
CError * m_errFoot;
CError * m_errNext;
int m_count;
public:
CErrorList();
~CErrorList();
void Clear();
bool LoadListFile(const char *path);
int Count();
CError * GetNext();
};
} // namespace error
} // namespace pglu
#endif // CERRLIST_H

View File

@ -0,0 +1,125 @@
#include <ctype.h>
#include <string.h>
#include "CFilter.h"
namespace pglu {
namespace filter {
namespace {
char *strichr(const char *str, int chr) {
const char *p = str;
chr = tolower((unsigned char)chr);
for(; tolower((unsigned char)(*p)) != chr; ++p)
if(*p == '\0')
return NULL;
return (char*)p;
}
char *stristr(const char *str, const char *pattern) {
if(*pattern == '\0')
return (char*)str;
const char *p = str;
size_t len = strlen(pattern);
for(; (p = strichr(p, pattern[0])) != NULL; ++p)
if(!strnicmp(p, pattern, len))
return (char*)p;
return NULL;
}
bool search_and(const char *str, const char *terms, const bool del) {
do {
if(!stristr(str, terms))
return del; // not found
while(*terms != '\0')
++terms;
++terms;
} while(*terms != '\0');
return !del; // found all
}
bool search_or(const char *str, const char *terms, const bool del) {
do {
if(stristr(str, terms))
return !del; // found
while(*terms != '\0')
++terms;
++terms;
} while(*terms != '\0');
return del; // not found
}
} // namespace
//--------------------------------------
// CFilter class
//--------------------------------------
CFilter::CFilter() :
m_terms(NULL)
{
}
CFilter::CFilter(const char *strFilter, const EFilterMode mode, const bool del) :
m_terms(NULL)
{
Assign(strFilter, mode, del);
}
CFilter::~CFilter() {
Clear();
}
void CFilter::Assign(const char *strFilter, const EFilterMode mode, const bool del) {
Clear();
if(mode == AND)
m_search = search_and;
else if(mode == OR)
m_search = search_or;
else
return;
m_mode = mode;
m_del = del;
m_terms = new char[strlen(strFilter) + 2];
while(*strFilter == ' ' || *strFilter == '\t')
++strFilter;
char *strTerms = m_terms;
while(*strFilter != '\0') {
*(strTerms++) = *(strFilter++);
if(*strFilter == ' ' || *strFilter == '\t') {
*(strTerms++) = '\0';
do {
++strFilter;
} while(*strFilter == ' ' || *strFilter == '\t');
}
}
*strTerms = '\0';
*(strTerms + 1) = '\0';
}
void CFilter::Clear() {
if(m_terms) {
delete[] m_terms;
m_terms = NULL;
}
}
bool CFilter::IsEmpty() {
if(m_terms)
return *m_terms == '\0';
else
return true;
}
bool CFilter::IsMatch(const char *str) {
return m_search(str, m_terms, m_del);
}
} // namespace filter
} // namespace pglu

View File

@ -0,0 +1,34 @@
#ifndef CFILTER_H
#define CFILTER_H
namespace pglu {
namespace filter {
typedef enum _EFilterMode {
AND,
OR
} EFilterMode;
class CFilter {
private:
char * m_terms;
EFilterMode m_mode;
bool m_del;
bool (* m_search)(const char *, const char *, const bool);
public:
CFilter();
CFilter(const char *strFilter, const EFilterMode mode, const bool del);
~CFilter();
void Assign(const char *strFilter, const EFilterMode mode, const bool del);
void Clear();
bool IsEmpty();
bool IsMatch(const char *str);
};
} // namespace filter
} // namespace pglu
#endif // CFILTER_H

View File

@ -0,0 +1,355 @@
#include <stdio.h>
#include <string.h>
#include "CIpList.h"
namespace pglu {
namespace ip {
namespace {
inline void Ip_Swap(CIp **ipA, CIp **ipB) {
CIp *ip = *ipA;
*ipA = *ipB;
*ipB = ip;
}
void Ip_SortByIpQuick(CIp **ipBegin, CIp **ipEnd) {
CIp **ipA;
CIp **ipB;
int nGap = ipEnd - ipBegin;
if(nGap < 64)
return;
ipA = ipBegin + ((int)(nGap / 2));
if((*ipBegin)->ip64 > (*ipA)->ip64)
Ip_Swap(ipBegin, ipA);
if((*ipBegin)->ip64 > (*ipEnd)->ip64)
Ip_Swap(ipBegin, ipEnd);
if((*ipA)->ip64 > (*ipEnd)->ip64)
Ip_Swap(ipA, ipEnd);
ulong ip64 = (*ipA)->ip64;
ipB = ipEnd - 1;
Ip_Swap(ipA, ipB);
ipA = ipBegin;
for(; ; ) {
while((*(++ipA))->ip64 < ip64);
while((*(--ipB))->ip64 > ip64);
if(ipA > ipB)
break;
Ip_Swap(ipA, ipB);
}
Ip_Swap(ipA, ipEnd - 1);
Ip_SortByIpQuick(ipBegin, ipB);
Ip_SortByIpQuick(ipA + 1, ipEnd);
}
void Ip_SortByIpInsert(CIp **ipBegin, CIp **ipEnd) {
CIp **ipA = ipBegin + 1;
CIp **ipB;
CIp **ipAEnd = ipEnd + 1;
CIp **ipBEnd = ipBegin - 1;
ulong ip64;
for(; ipA != ipAEnd; ++ipA) {
ip64 = (*ipA)->ip64;
for(ipB = ipA - 1; ipB != ipBEnd && (*ipB)->ip64 > ip64; --ipB)
Ip_Swap(ipB, ipB + 1);
}
}
void Ip_SortByIp(CIp **ipBegin, CIp **ipEnd) {
Ip_SortByIpQuick(ipBegin, ipEnd);
Ip_SortByIpInsert(ipBegin, ipEnd);
}
CIp * Ip_SortByCaption(CIp *ipHeadA) {
if(!ipHeadA || !(ipHeadA->next))
return ipHeadA;
// split ipBを2倍で進めることでipAを中間位置に持っていく
CIp *ipA = ipHeadA;
CIp *ipB = ipHeadA->next->next;
while(ipB) {
ipA = ipA->next;
ipB = ipB->next;
if(ipB)
ipB = ipB->next;
}
CIp *ipHeadB = ipA->next;
ipA->next = NULL;
ipHeadA = Ip_SortByCaption(ipHeadA);
ipHeadB = Ip_SortByCaption(ipHeadB);
// merge
CIp ipMerged;
ipA = &ipMerged;
while(ipHeadA || ipHeadB) {
if(((ipHeadA && ipHeadB) && stricmp(ipHeadA->caption, ipHeadB->caption) <= 0) || !ipHeadB) {
ipA->next = ipHeadA;
ipHeadA = ipHeadA->next;
} else {
ipA->next = ipHeadB;
ipHeadB = ipHeadB->next;
}
ipA = ipA->next;
}
ipA->next = NULL;
return ipMerged.next;
}
} // namespace
//--------------------------------------
// CIpList class
//--------------------------------------
CIpList::CIpList() :
m_poolIp(sizeof(CIp)),
m_ipFoot(&m_ipHead),
m_count(0),
m_countDisabled(0)
{
m_ipHead.caption = NULL;
m_ipHead.ip64 = 0L;
m_ipHead.next = NULL;
}
CIpList::~CIpList() {
Clear();
}
void CIpList::Clear() {
for(CIp *ip = m_ipHead.next; ip; ip = ip->next)
delete[] ip->caption;
m_poolIp.purge_memory();
m_ipHead.next = NULL;
m_ipFoot = &m_ipHead;
m_count = 0;
m_countDisabled = 0;
UnSetFilter();
}
void CIpList::SetFilter(const char *filter, const filter::EFilterMode mode, const bool del) {
m_filter.Assign(filter, mode, del);
}
void CIpList::UnSetFilter() {
m_filter.Clear();
}
CIp * CIpList::CreateIp(boost::xpressive::cmatch & match) {
CIp *ip = (CIp*)m_poolIp.malloc();
const char *capBegin = match.prefix().first;
const char *capEnd = match[9].first;
size_t lenCap = capEnd - capBegin;
char *chunk = new char[lenCap + 1];
memcpy(chunk, capBegin, lenCap);
*(chunk + lenCap) = '\0';
ip->caption = chunk;
uchar *ip8 = ip->ip8;
ip8[4] = ParseDigit3(match[4].first, match[4].second);
ip8[5] = ParseDigit3(match[3].first, match[3].second);
ip8[6] = ParseDigit3(match[2].first, match[2].second);
ip8[7] = ParseDigit3(match[1].first, match[1].second);
if(*(match[10].first) == '-') {
ip8[0] = ParseDigit3(match[8].first, match[8].second);
ip8[1] = ParseDigit3(match[7].first, match[7].second);
ip8[2] = ParseDigit3(match[6].first, match[6].second);
ip8[3] = ParseDigit3(match[5].first, match[5].second);
} else {
ip->ip32[0] = ip->ip32[1] | (0xFFFFFFFF >> ParseDigit3(match[11].first, match[11].second));
}
return ip;
}
bool CIpList::LoadListFile(const char *path) {
char buf[PGLU_LENGTH_FILELINE];
char colon;
char *colon_p;
using namespace boost::xpressive;
static cmatch match;
static mark_tag tagIp1(1), tagIp2(2), tagIp3(3), tagIp4(4), tagIp5(5), tagIp6(6), tagIp7(7), tagIp8(8);
static mark_tag tagColon(9), tagSep(10), tagMask(11);
static cregex reSyntax = // bos >> (tag = *_) >> // slower
(tagColon = as_xpr(':')) >> *_s >>
(tagIp1 = repeat<1, 3>(_d)) >> as_xpr('.') >>
(tagIp2 = repeat<1, 3>(_d)) >> as_xpr('.') >>
(tagIp3 = repeat<1, 3>(_d)) >> as_xpr('.') >>
(tagIp4 = repeat<1, 3>(_d)) >>
*_s >> (tagSep = as_xpr('-')) >> *_s >>
(tagIp5 = repeat<1, 3>(_d)) >> as_xpr('.') >>
(tagIp6 = repeat<1, 3>(_d)) >> as_xpr('.') >>
(tagIp7 = repeat<1, 3>(_d)) >> as_xpr('.') >>
(tagIp8 = repeat<1, 3>(_d)) >>
*_s >> (_ln | eos);
static cregex reSyntaxRestorable =
(tagColon = !as_xpr(':')) >> *_s >>
(tagIp1 = repeat<1, 3>(_d)) >> (set = '.', ',') >>
(tagIp2 = repeat<1, 3>(_d)) >> (set = '.', ',') >>
(tagIp3 = repeat<1, 3>(_d)) >> (set = '.', ',') >>
(tagIp4 = repeat<1, 3>(_d)) >> *_s >> (
(tagSep = +as_xpr('-')) >> *_s >>
(tagIp5 = repeat<1, 3>(_d)) >> (set = '.', ',') >>
(tagIp6 = repeat<1, 3>(_d)) >> (set = '.', ',') >>
(tagIp7 = repeat<1, 3>(_d)) >> (set = '.', ',') >>
(tagIp8 = repeat<1, 3>(_d))
|
(tagSep = +(set = '/', '\\')) >> *_s >>
(tagMask = repeat<1, 2>(_d))
) >> *_s >> (_ln | eos);
FILE *fp = fopen(path, "r");
if(fp == NULL)
return false;
CIp *ip = m_ipFoot;
if(m_filter.IsEmpty()) {
while(fgets(buf, PGLU_LENGTH_FILELINE, fp)) {
if(regex_search(buf, match, reSyntax) || regex_search(buf, match, reSyntaxRestorable)) {
++m_count;
ip->next = CreateIp(match);
ip = ip->next;
}
#ifdef __MINGW32__
ZeroString(buf);
#endif
}
} else {
while(fgets(buf, PGLU_LENGTH_FILELINE, fp)) {
if(regex_search(buf, match, reSyntax) || regex_search(buf, match, reSyntaxRestorable)) {
colon_p = (char*)(match[9].first);
colon = *colon_p;
*colon_p = '\0';
if(m_filter.IsMatch(buf)) {
++m_count;
ip->next = CreateIp(match);
ip = ip->next;
}
*colon_p = colon;
}
#ifdef __MINGW32__
ZeroString(buf);
#endif
}
}
fclose(fp);
ip->next = NULL;
m_ipFoot = ip;
return true;
}
bool CIpList::SaveListFile(const char *path, const bool append) {
uchar *ip8;
FILE *fp = fopen(path, (append ? "a" : "w"));
if(fp == NULL)
return false;
for(CIp *ip = m_ipHead.next; ip; ip = ip->next) {
// IPが0Lなら書き出さない
if(ip->ip64 != 0L) {
ip8 = ip->ip8;
fprintf(fp,
"%s:%u.%u.%u.%u-%u.%u.%u.%u\n",
ip->caption,
ip8[7], ip8[6], ip8[5], ip8[4],
ip8[3], ip8[2], ip8[1], ip8[0]
);
}
}
fclose(fp);
return true;
}
void CIpList::CheckAndSort(const bool sortCap, const bool sortIp, const bool delDupIp) {
CIp **ipBegin;
CIp **ipEnd;
CIp *ip;
if(m_count < 2)
return;
if(sortIp || delDupIp) {
// リストから配列を複製
CIp **ipSort = new CIp*[m_count];
ipBegin = ipSort;
for(ip = m_ipHead.next; ip; ip = ip->next)
*(ipBegin++) = ip;
// 配列をソート
Ip_SortByIp(ipSort, ipSort + m_count - 1);
if(delDupIp) {
// すでにIPが0Lなものを無効としてカウント
ipBegin = ipSort;
ipEnd = ipBegin + m_count;
for(; ipBegin != ipEnd && (*ipBegin)->ip64 == 0L; ++ipBegin)
++m_countDisabled;
if(ipBegin == ipEnd)
goto END_SORT; // 全てのIPが0L
// 重複したIPは0Lにして無効としてカウント
for(--ipEnd; ipBegin != ipEnd; ++ipBegin)
if((*ipBegin)->ip64 == (*(ipBegin + 1))->ip64) {
(*ipBegin)->ip64 = 0L;
++m_countDisabled;
}
}
if(sortIp) {
// 配列の中身を連結
ipBegin = ipSort;
ipEnd = ipSort + m_count;
ip = &m_ipHead;
while(ipBegin != ipEnd) {
ip->next = *(ipBegin++);
ip = ip->next;
}
ip->next = NULL;
}
END_SORT:
delete[] ipSort;
}
if(sortCap)
m_ipHead.next = Ip_SortByCaption(m_ipHead.next);
if(sortIp || sortCap) {
// m_ipFootを再設定
ip = m_ipHead.next;
if(ip) {
for(; ip->next; ip = ip->next);
m_ipFoot = ip;
} else {
m_ipFoot = &m_ipHead;
}
}
}
int CIpList::Count() {
return m_count;
}
int CIpList::CountDisabled() {
return m_countDisabled;
}
} // namespace ip
} // namespace pglu

View File

@ -0,0 +1,56 @@
#ifndef CIPLIST_H
#define CIPLIST_H
#include <boost/pool/pool.hpp>
#include <boost/xpressive/xpressive.hpp>
#include "common.h"
#include "CFilter.h"
namespace pglu {
namespace ip {
struct CIp {
char * caption;
union {
ulong ip64;
uint ip32[2];
uchar ip8[8];
};
CIp * next;
};
class CIpList {
private:
boost::pool<> m_poolIp;
CIp m_ipHead;
CIp * m_ipFoot;
filter::CFilter m_filter;
int m_count;
int m_countDisabled;
CIp * CreateIp(boost::xpressive::cmatch & match);
public:
CIpList();
~CIpList();
void Clear();
void SetFilter(const char *filter, const filter::EFilterMode mode, const bool del);
void UnSetFilter();
bool LoadListFile(const char *path);
bool SaveListFile(const char *path, const bool append);
void CheckAndSort(const bool sortCap, const bool sortIp, const bool delDupIp);
int Count();
int CountDisabled();
};
} // namespace ip
} // namespace pglu
#endif // CIPLIST_H

View File

@ -0,0 +1,48 @@
#ifndef COMMON_H
#define COMMON_H
#ifdef _MSC_VER
typedef unsigned __int8 uchar;
typedef unsigned __int32 uint;
typedef unsigned __int64 ulong;
# else
#include <boost/cstdint.hpp>
typedef uint8_t uchar;
typedef uint32_t uint;
typedef uint64_t ulong;
#endif
namespace pglu {
#define PGLU_LENGTH_FILELINE 1024
inline uint ParseDigit3(const char *begin, const char *end) {
switch(end - begin) {
case 3:
return ((*begin & 0xF) * 100) + ((*(begin + 1) & 0xF) * 10) + (*(begin + 2) & 0xF);
case 2:
return ((*begin & 0xF) * 10) + (*(begin + 1) & 0xF);
case 1:
return (*begin & 0xF);
default:
return 256;
}
}
#ifdef __MINGW32__
inline void ZeroString(char *str) {
while(*str != '\0')
*(str++) = '\0';
}
#endif
} // namespace pglu
#endif // COMMON_H