mirror of
https://codeberg.org/crimeflare/cloudflare-tor
synced 2024-12-22 07:30:32 +00:00
Compare commits
27 Commits
c751bfaba6
...
0376987484
Author | SHA1 | Date | |
---|---|---|---|
|
0376987484 | ||
|
6a5a306174 | ||
|
96dc98787c | ||
|
363b6142b7 | ||
|
5bead826b4 | ||
|
0b5158b6c6 | ||
|
0bd683e5c3 | ||
|
512b2f403b | ||
|
424eb7f686 | ||
|
359887b8af | ||
|
b346040be7 | ||
|
f51ebd72f9 | ||
|
66abe592a8 | ||
|
104498cd7c | ||
|
5bb8cb7eb3 | ||
|
3bf26ccf6e | ||
|
0c4603ea16 | ||
|
ff1c78f667 | ||
|
a9765c7c0e | ||
|
c07497fc1a | ||
|
0915b80097 | ||
|
69595de83b | ||
|
b3a4f05d9f | ||
|
225e7b2ef1 | ||
|
487085a0e5 | ||
|
19e95a12ab | ||
|
ab384049a1 |
@ -9,8 +9,3 @@
|
||||
|
||||
- [Permesilo / License](LICENSE.md)
|
||||
|
||||
|
||||
[![](image/icon.rss.jpg)](https://en.wikipedia.org/wiki/Internet_censorship#Censorship_of_users_by_web_service_operators)
|
||||
[![](image/icon.toot.jpg)](https://en.wikipedia.org/wiki/Internet_censorship#Censorship_of_users_by_web_service_operators)
|
||||
|
||||
<a rel="me" href="https://localhost/@sunny"></a>
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
[//]: # (do not edit me; start)
|
||||
|
||||
## *69,242* FQDN
|
||||
## *69,617* FQDN
|
||||
|
||||
[//]: # (do not edit me; end)
|
||||
|
||||
|
@ -4,6 +4,7 @@ Kontraŭ-homa gvatada & cenzura kompanio.
|
||||
|
||||
![](../image/blockedbyjustin.jpg)
|
||||
![](../image/blockedbymatthewprince.jpg)
|
||||
![](../image/blockedbymatthewprince2.jpg)
|
||||
|
||||
Bonvolu vidi [INSTRUCTION.md](../INSTRUCTION.md) por dosiera celo kaj formato specifoj.
|
||||
|
||||
|
@ -87,6 +87,9 @@
|
||||
104.20.64.0/20
|
||||
104.20.80.0/20
|
||||
104.20.96.0/20
|
||||
104.21.192.0/20
|
||||
104.21.224.0/20
|
||||
104.21.64.0/19
|
||||
104.22.0.0/20
|
||||
104.22.16.0/20
|
||||
104.22.32.0/20
|
||||
@ -163,20 +166,22 @@
|
||||
104.28.96.0/19
|
||||
104.31.0.0/20
|
||||
104.31.112.0/22
|
||||
104.31.128.0/20
|
||||
104.31.128.0/19
|
||||
104.31.144.0/20
|
||||
104.31.16.0/20
|
||||
104.31.160.0/19
|
||||
104.31.176.0/20
|
||||
104.31.192.0/19
|
||||
104.31.208.0/20
|
||||
104.31.224.0/20
|
||||
104.31.224.0/19
|
||||
104.31.240.0/20
|
||||
104.31.64.0/19
|
||||
104.31.80.0/20
|
||||
108.162.192.0/18
|
||||
108.162.193.0/24
|
||||
108.162.194.0/24
|
||||
108.162.195.0/24
|
||||
108.162.196.0/24
|
||||
108.162.208.0/24
|
||||
108.162.210.0/24
|
||||
108.162.211.0/24
|
||||
@ -291,6 +296,8 @@
|
||||
162.158.146.0/24
|
||||
162.158.147.0/24
|
||||
162.158.148.0/22
|
||||
162.158.149.0/24
|
||||
162.158.151.0/24
|
||||
162.158.152.0/22
|
||||
162.158.156.0/22
|
||||
162.158.16.0/22
|
||||
@ -323,6 +330,9 @@
|
||||
162.158.207.0/24
|
||||
162.158.208.0/22
|
||||
162.158.212.0/22
|
||||
162.158.213.0/24
|
||||
162.158.214.0/24
|
||||
162.158.215.0/24
|
||||
162.158.216.0/23
|
||||
162.158.218.0/23
|
||||
162.158.220.0/22
|
||||
@ -331,6 +341,7 @@
|
||||
162.158.226.0/23
|
||||
162.158.228.0/22
|
||||
162.158.232.0/22
|
||||
162.158.234.0/23
|
||||
162.158.236.0/22
|
||||
162.158.24.0/23
|
||||
162.158.240.0/22
|
||||
@ -447,6 +458,7 @@
|
||||
162.159.7.0/24
|
||||
162.159.8.0/24
|
||||
162.159.9.0/24
|
||||
162.247.243.0/24
|
||||
162.251.82.0/24
|
||||
172.64.0.0/13
|
||||
172.64.112.0/20
|
||||
@ -457,10 +469,16 @@
|
||||
172.64.176.0/20
|
||||
172.64.192.0/20
|
||||
172.64.208.0/20
|
||||
172.64.240.0/20
|
||||
172.64.32.0/20
|
||||
172.64.33.0/24
|
||||
172.64.34.0/24
|
||||
172.64.35.0/24
|
||||
172.64.36.0/23
|
||||
172.64.38.0/24
|
||||
172.64.48.0/20
|
||||
172.64.64.0/20
|
||||
172.64.80.0/20
|
||||
172.64.96.0/20
|
||||
172.65.0.0/19
|
||||
172.65.112.0/20
|
||||
@ -473,7 +491,7 @@
|
||||
172.65.208.0/20
|
||||
172.65.224.0/20
|
||||
172.65.240.0/20
|
||||
172.65.32.0/20
|
||||
172.65.32.0/19
|
||||
172.65.48.0/20
|
||||
172.65.64.0/20
|
||||
172.65.80.0/20
|
||||
@ -489,9 +507,11 @@
|
||||
172.67.208.0/20
|
||||
172.67.224.0/20
|
||||
172.67.240.0/20
|
||||
172.67.32.0/20
|
||||
172.67.48.0/20
|
||||
172.67.64.0/20
|
||||
172.67.80.0/20
|
||||
172.67.96.0/20
|
||||
172.68.0.0/22
|
||||
172.68.100.0/22
|
||||
172.68.104.0/22
|
||||
@ -503,6 +523,7 @@
|
||||
172.68.124.0/22
|
||||
172.68.128.0/22
|
||||
172.68.129.0/24
|
||||
172.68.130.0/24
|
||||
172.68.131.0/24
|
||||
172.68.132.0/22
|
||||
172.68.136.0/22
|
||||
@ -515,6 +536,7 @@
|
||||
172.68.164.0/23
|
||||
172.68.166.0/23
|
||||
172.68.168.0/23
|
||||
172.68.169.0/24
|
||||
172.68.170.0/24
|
||||
172.68.171.0/24
|
||||
172.68.172.0/22
|
||||
@ -543,6 +565,7 @@
|
||||
172.68.31.0/24
|
||||
172.68.32.0/22
|
||||
172.68.36.0/22
|
||||
172.68.38.0/24
|
||||
172.68.4.0/22
|
||||
172.68.40.0/22
|
||||
172.68.44.0/22
|
||||
@ -725,6 +748,7 @@
|
||||
198.41.241.0/24
|
||||
198.41.242.0/24
|
||||
198.41.243.0/24
|
||||
198.41.244.0/24
|
||||
198.41.245.0/24
|
||||
198.41.246.0/23
|
||||
198.41.248.0/23
|
||||
@ -767,9 +791,14 @@
|
||||
8.20.253.0/24
|
||||
8.21.10.0/24
|
||||
8.21.11.0/24
|
||||
8.21.110.0/24
|
||||
8.21.111.0/24
|
||||
8.21.13.0/24
|
||||
8.21.238.0/24
|
||||
8.21.8.0/24
|
||||
8.21.9.0/24
|
||||
8.23.139.0/24
|
||||
8.23.240.0/24
|
||||
8.31.160.0/24
|
||||
8.31.161.0/24
|
||||
8.35.211.0/24
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,7 @@
|
||||
|
||||
[//]: # (do not edit me; start)
|
||||
|
||||
## *6,376,197* domajnoj
|
||||
## *6,377,712* domajnoj
|
||||
|
||||
[//]: # (do not edit me; end)
|
||||
|
||||
|
@ -8156,6 +8156,7 @@ eaglesnestgr.co.za
|
||||
eaglesnesthoa.org
|
||||
eaglesnesthomecare.com
|
||||
eaglesnestleadership.org
|
||||
eaglesnestoutfittersinc.com
|
||||
eaglesnestpdts.com
|
||||
eaglesnestsportsbar.com
|
||||
eaglesnesttownship.com
|
||||
@ -8316,6 +8317,7 @@ eaglid.com
|
||||
eaglie.com
|
||||
eaglight.co
|
||||
eaglingvision.com
|
||||
eaglinvest.com
|
||||
eagliz.com
|
||||
eaglocky.com
|
||||
eaglonsports.com
|
||||
@ -10506,6 +10508,7 @@ earnmorefordoingless.com
|
||||
earnmorehits.com
|
||||
earnmorespendmoregroup.com
|
||||
earnmoretoday.com
|
||||
earnmost.online
|
||||
earnmy.cf
|
||||
earnmydegree.club
|
||||
earnmydegree.info
|
||||
@ -12382,6 +12385,7 @@ easewatch.com
|
||||
easewholes.top
|
||||
easewigs.com
|
||||
easewindowcleaning.com
|
||||
easewindows.com
|
||||
easewiser.com
|
||||
easewit.com
|
||||
easewonderfuls.top
|
||||
@ -20565,6 +20569,7 @@ eb-blumenau.com.br
|
||||
eb-books-m.ga
|
||||
eb-cash.ru
|
||||
eb-cc.com
|
||||
eb-cdn.com.au
|
||||
eb-energy.pl
|
||||
eb-exterminating.com
|
||||
eb-family.org
|
||||
@ -22727,6 +22732,7 @@ ebleather.com
|
||||
eblecrohal.tk
|
||||
eblej.biz
|
||||
eblelibrari.live
|
||||
eblens.com
|
||||
ebleonard.us
|
||||
eblerputa.tk
|
||||
eblessedlife.com
|
||||
@ -24599,6 +24605,7 @@ ebookpdf.ga
|
||||
ebookpdf.gq
|
||||
ebookpdf.xyz
|
||||
ebookpdfblog.ooo
|
||||
ebookpdfc.xyz
|
||||
ebookpdfdownload.us
|
||||
ebookpdfdownloadcom.xyz
|
||||
ebookpdfes.club
|
||||
@ -45277,6 +45284,7 @@ edstireandalignment.com
|
||||
edstock.club
|
||||
edstoft.dk
|
||||
edstoneservice.site
|
||||
edstore24.com
|
||||
edstour.ga
|
||||
edstowingservices.com
|
||||
edstrat.com
|
||||
@ -45296,6 +45304,7 @@ edswayengineering.com
|
||||
edswellness.org
|
||||
edsworkbench.net
|
||||
edswrevue.org
|
||||
edsy.ga
|
||||
edsyart.com
|
||||
edsylchicon.cf
|
||||
edsylchicon.tk
|
||||
@ -45514,6 +45523,7 @@ edu-home.fyi
|
||||
edu-hopkins.photography
|
||||
edu-huay.com
|
||||
edu-importance.ru
|
||||
edu-india.org
|
||||
edu-institute.com
|
||||
edu-kayaks.com.ar
|
||||
edu-kingdom.com
|
||||
@ -45663,6 +45673,7 @@ edu1ife.ru
|
||||
edu24.club
|
||||
edu24shiksha.com
|
||||
edu25h.com
|
||||
edu2iq.com
|
||||
edu2review.com
|
||||
edu365.ltd
|
||||
edu380.com
|
||||
@ -46154,6 +46165,7 @@ educadoraam.com.br
|
||||
educadorapf.com
|
||||
educadordelfuturo.com
|
||||
educadoreslive.com
|
||||
educadoresqueinspiran.org
|
||||
educadorfinanceirorodolfocabracom.ga
|
||||
educadorinspirador.com.br
|
||||
educaead.net
|
||||
@ -46182,6 +46194,7 @@ educalgaeinfo.ga
|
||||
educalgaeinfo.gq
|
||||
educalgaenet.gq
|
||||
educaline.fr
|
||||
educall.co
|
||||
educalling.com
|
||||
educallis.com.br
|
||||
educallis.com.vc
|
||||
@ -46460,6 +46473,7 @@ educatentcom.gq
|
||||
educatentinfo.cf
|
||||
educatentinfo.ga
|
||||
educatentinfo.gq
|
||||
educatenurturingangel.monster
|
||||
educateonline.club
|
||||
educateoutside.com
|
||||
educateposh.com
|
||||
@ -46472,6 +46486,7 @@ educatestscom.ga
|
||||
educatestscom.gq
|
||||
educatestsinfo.cf
|
||||
educatestsnet.gq
|
||||
educatesuccessalmsgiver.top
|
||||
educatetanzania.org
|
||||
educatethenorth.com
|
||||
educatetheworkforce.net
|
||||
@ -46628,6 +46643,7 @@ educationalconsultingofnnj.com
|
||||
educationalcritique.cf
|
||||
educationalds.com
|
||||
educationaledventures.com
|
||||
educationalera.in
|
||||
educationalesq.com
|
||||
educationalfirst.com
|
||||
educationalfiscal.tk
|
||||
@ -46644,6 +46660,7 @@ educationalonlineservicesnj.com
|
||||
educationalplaycare.com
|
||||
educationalplaytimetoo.com
|
||||
educationalpracticesfoundation.org
|
||||
educationalprintables.com
|
||||
educationalpsych.co.uk
|
||||
educationalpsychology.cymru
|
||||
educationalpsychology.wales
|
||||
@ -47513,6 +47530,7 @@ educrux.co.in
|
||||
educsale.xyz
|
||||
educsante.com
|
||||
educt.in
|
||||
educt.lt
|
||||
eductancecom.cf
|
||||
eductancecom.ga
|
||||
eductancecom.gq
|
||||
@ -47706,6 +47724,7 @@ edudaan.com
|
||||
edudaleal.com
|
||||
edudatingapp.ml
|
||||
edudeco.com
|
||||
edudeed.com
|
||||
edudek.org
|
||||
edudellsr-chaplain.com
|
||||
edudemic.com
|
||||
@ -47713,6 +47732,7 @@ edudemy.com
|
||||
edudemy.org
|
||||
edudeqiv.tk
|
||||
edudesigns.eu
|
||||
edudesire.in
|
||||
edudesiredn.cf
|
||||
edudetails.com
|
||||
edudezyzyn.tk
|
||||
@ -47851,6 +47871,7 @@ edugoholidays.com
|
||||
edugold.org
|
||||
edugorilla.com
|
||||
edugouv.shop
|
||||
edugovloans.com
|
||||
edugrad.com
|
||||
edugrande.com
|
||||
edugrant.me
|
||||
@ -48036,6 +48057,7 @@ edulink.me
|
||||
edulink.pt
|
||||
edulink7.com
|
||||
edulip.com
|
||||
edulir.com
|
||||
edulis-capital.com
|
||||
edulist.asia
|
||||
edulisting.com
|
||||
@ -48146,6 +48168,7 @@ edumaritime.net
|
||||
edumarket.az
|
||||
edumarketing.academy
|
||||
edumarketingplaygrounddesigns.com
|
||||
edumarketingsummit.com
|
||||
edumarkindia.in
|
||||
edumarking-covid.com
|
||||
edumarkingplaygrounddesigns.com
|
||||
@ -48391,6 +48414,7 @@ eduryzefames.tk
|
||||
edus-jungs-geesthacht.de
|
||||
edus.my
|
||||
edus.ru.net
|
||||
edusains.net
|
||||
edusaint.com
|
||||
edusalsa.com
|
||||
edusancau.gq
|
||||
@ -48475,6 +48499,7 @@ eduss.org
|
||||
edusson.com
|
||||
edustargroup.com
|
||||
edustarschool.com
|
||||
edustarted.com
|
||||
edustat.xyz
|
||||
edustemtech.com.au
|
||||
edustenia.com
|
||||
@ -49618,6 +49643,7 @@ ee-francoallemand.com
|
||||
ee-helpdesk.com
|
||||
ee-hire.com
|
||||
ee-id150.com
|
||||
ee-idac.com
|
||||
ee-impots.ml
|
||||
ee-it.co.uk
|
||||
ee-lampor.cf
|
||||
@ -59527,6 +59553,7 @@ egyrx.com
|
||||
egysacom.com
|
||||
egyscoop.com
|
||||
egysex.me
|
||||
egyshare.cam
|
||||
egyshop.net
|
||||
egyshow.com
|
||||
egysirc.cf
|
||||
@ -65395,6 +65422,7 @@ ejirhk.us
|
||||
ejirisan.com
|
||||
ejiroowusu.com
|
||||
ejirymimypewy.tk
|
||||
ejirytuw.xyz
|
||||
ejiryyufexequz.tk
|
||||
ejisajud.tk
|
||||
ejisavujedor.tk
|
||||
@ -65604,6 +65632,7 @@ ejobsresult.com
|
||||
ejobsreviewy.ga
|
||||
ejobuqas.tk
|
||||
ejoburg.com
|
||||
ejobwala.com
|
||||
ejoceladetix.tk
|
||||
ejocimyhukixaze.tk
|
||||
ejocuribarbie.co
|
||||
@ -73836,6 +73865,7 @@ elections.org.za
|
||||
elections.org.zm
|
||||
elections.pk
|
||||
elections.ro
|
||||
elections.wi.gov
|
||||
elections2019.ga
|
||||
electionsausagesizzle.com.au
|
||||
electionsbycounty.com
|
||||
@ -76353,6 +76383,7 @@ electude.com
|
||||
electude.com.cn
|
||||
electude.eu
|
||||
electude.org
|
||||
electumwallet.app
|
||||
electuralstore.com
|
||||
electus.nu
|
||||
electusglow.club
|
||||
@ -85126,6 +85157,7 @@ elitetrellis.com
|
||||
elitetrends.net
|
||||
elitetrendz.com
|
||||
elitetrenz.club
|
||||
elitetrimworks.com
|
||||
elitetrueproducts.com
|
||||
elitetrusts.com
|
||||
eliteturk.tk
|
||||
@ -89344,6 +89376,7 @@ elmstructural.com
|
||||
elmtech.io
|
||||
elmtecheg.com
|
||||
elmterracegardens.org
|
||||
elmthaly-clean.com
|
||||
elmthaly-group.com
|
||||
elmtrail.com
|
||||
elmtreecounseling.com
|
||||
@ -89531,6 +89564,7 @@ elneti.ga
|
||||
elnetpoland.eu
|
||||
elnetworkerdigital.com
|
||||
elnetworkmarketing.com
|
||||
elnevents.com
|
||||
elnevinlo.ga
|
||||
elnews.gr
|
||||
elnewsletter.com
|
||||
@ -95335,6 +95369,7 @@ email-online-verifier.gq
|
||||
email-oprosec.today
|
||||
email-optout.com
|
||||
email-outlook.eu.org
|
||||
email-password.xyz
|
||||
email-pm.com
|
||||
email-pm17.com
|
||||
email-pm23.com
|
||||
@ -99835,6 +99870,7 @@ emerite.ca
|
||||
emeritipublishing.com
|
||||
emeritusmagics.ga
|
||||
emerj.net
|
||||
emerkezgiiris-hemenalgir.com
|
||||
emerkgoods.xyz
|
||||
emerky.win
|
||||
emerland.su
|
||||
@ -106950,6 +106986,7 @@ empoweryoutherapy.co.uk
|
||||
empoweryouwellness.com
|
||||
empoweryurlife.com
|
||||
empowerzambia.com
|
||||
empowerzip.com
|
||||
empowherannapolisvalley.com
|
||||
empowherdstrands.com
|
||||
empowr.today
|
||||
@ -114051,6 +114088,7 @@ enelozopehez.tk
|
||||
enelpa.org
|
||||
enelpeidis.cf
|
||||
enelphuni.tk
|
||||
eneltaa.com
|
||||
enelteco.at
|
||||
enelteco.de
|
||||
enelteco.eu
|
||||
@ -115388,6 +115426,7 @@ energyofallowing.com
|
||||
energyofdreams.us
|
||||
energyoflifeinstitutecr.com
|
||||
energyofnorthdakota.com
|
||||
energyonesolution.com
|
||||
energyonline.club
|
||||
energyorbits.com
|
||||
energyos.io
|
||||
@ -116749,6 +116788,7 @@ engagingcomms.com
|
||||
engagingcomms.com.au
|
||||
engagingculture.co
|
||||
engagingcultures.com
|
||||
engagingemployeesupdate.com
|
||||
engaginggarments.com
|
||||
engaginggospeldoctrine.com
|
||||
engaginglearners.com
|
||||
@ -126749,6 +126789,7 @@ entruempelungen-umzuege-rlp.de
|
||||
entruempelungshelden.at
|
||||
entruly.com
|
||||
entrust-ssl.com
|
||||
entrust.com
|
||||
entrust.org.uk
|
||||
entrust.us.com
|
||||
entrustbuilders.com
|
||||
@ -132169,6 +132210,7 @@ epic.reviews
|
||||
epic.tw
|
||||
epic.vg
|
||||
epic180.com
|
||||
epic1lotto.com
|
||||
epic1marketing.com
|
||||
epic2.tk
|
||||
epic337.com
|
||||
@ -135569,6 +135611,7 @@ epsonstqore.cf
|
||||
epsonstqore.ga
|
||||
epsonstqore.gq
|
||||
epsonstqore.tk
|
||||
epsonwindows10.com
|
||||
epsonwindowsdrivers.com
|
||||
epsoprep.com
|
||||
epsos.co.il
|
||||
@ -149721,6 +149764,7 @@ error-16843.info
|
||||
error-17048.host
|
||||
error-18268.info
|
||||
error-1dexx001-53d1.win
|
||||
error-22583.info
|
||||
error-269d1.stream
|
||||
error-27202.space
|
||||
error-28410.info
|
||||
@ -163056,6 +163100,7 @@ esrtt.com
|
||||
esrueconte.cf
|
||||
esrumo.club
|
||||
esrushl.com
|
||||
esrv.cc
|
||||
esrvideos.cf
|
||||
esrwallet.io
|
||||
esryobqufunme.gq
|
||||
@ -165842,6 +165887,7 @@ esta-visa.services
|
||||
esta-visa.us
|
||||
esta-visaform.us
|
||||
esta-visawaiver.us
|
||||
esta-yapi.com
|
||||
esta.co
|
||||
esta.co.kr
|
||||
esta.es
|
||||
@ -174956,6 +175002,7 @@ etornbyphonen.gq
|
||||
etoro-bitcoin.club
|
||||
etoro-opinioni.com
|
||||
etoro-page.com
|
||||
etoro.com
|
||||
etoro.com.hk
|
||||
etorocoinoption.com
|
||||
etorocopytrader.pw
|
||||
@ -175245,6 +175292,7 @@ etrackbull.com
|
||||
etrackengineer.com
|
||||
etracker-amp.de
|
||||
etrackera.nl
|
||||
etrackerbee.com
|
||||
etracking-pocztapolska24.net
|
||||
etracking-ppocztapolska.com
|
||||
etracking.tk
|
||||
@ -177784,6 +177832,7 @@ eujqci.top
|
||||
eujqctjn.com
|
||||
eujssda.com
|
||||
eujtdi.xyz
|
||||
eujump.xyz
|
||||
eujwas.com
|
||||
euk054.com
|
||||
euk56s.com
|
||||
@ -180163,6 +180212,7 @@ euronews.biz
|
||||
euronews.lv
|
||||
euronews2020.com
|
||||
euronewsblog.tk
|
||||
euronewshub.com
|
||||
euronewsweek.com
|
||||
euronexttoday.co.uk
|
||||
euronguyen.com
|
||||
@ -197161,6 +197211,7 @@ examversity.com
|
||||
examwarriors.org
|
||||
examwatch.com
|
||||
examwing.com
|
||||
examworks.com
|
||||
examworx.tk
|
||||
examy.men
|
||||
examymdis.tk
|
||||
@ -202315,6 +202366,7 @@ exigencyonline.pl
|
||||
exigenelixir.uk
|
||||
exigenservices.se
|
||||
exigent-group.com
|
||||
exigent-info.com
|
||||
exigent.cf
|
||||
exigentbits.com
|
||||
exigentcircumstances.ga
|
||||
@ -206975,6 +207027,7 @@ expisores.ml
|
||||
expisores.tk
|
||||
expitage.us
|
||||
expitcommi.us
|
||||
expitris.info
|
||||
expitshare.com
|
||||
expjd.com
|
||||
expjntsys.com
|
||||
@ -208799,6 +208852,8 @@ expreadtoken.com
|
||||
exprealty.com
|
||||
exprect.de
|
||||
expreespkg.tk
|
||||
expreess53-us.online
|
||||
expreess53-us1.online
|
||||
exprefer.cf
|
||||
exprefer.gq
|
||||
exprefer.tk
|
||||
@ -211978,6 +212033,7 @@ extramovies.bid
|
||||
extramovies.casa
|
||||
extramovies.co.in
|
||||
extramovies.cool
|
||||
extramovies.fit
|
||||
extramovies.guru
|
||||
extramovies.host
|
||||
extramovies.io
|
||||
@ -211995,6 +212051,7 @@ extramovies.plus
|
||||
extramovies.pro
|
||||
extramovies.pw
|
||||
extramovies.red
|
||||
extramovies.rest
|
||||
extramovies.rip
|
||||
extramovies.rocks
|
||||
extramovies.run
|
||||
@ -212341,6 +212398,7 @@ extratorrents.com.pl
|
||||
extratorrents.eu.org
|
||||
extratorrents.fun
|
||||
extratorrents.io
|
||||
extratorrents.it
|
||||
extratorrents.online
|
||||
extratorrents.org.pl
|
||||
extratorrents.shop
|
||||
@ -213900,6 +213958,7 @@ ey-books-u.cf
|
||||
ey-booksu.ml
|
||||
ey-maekumi.com
|
||||
ey.app
|
||||
ey.com
|
||||
ey.md
|
||||
ey01j.us
|
||||
ey050tnet.gq
|
||||
|
BIN
image/blockedbymatthewprince2.jpg
Normal file
BIN
image/blockedbymatthewprince2.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB |
6
tool/PGListUtil/README.md
Normal file
6
tool/PGListUtil/README.md
Normal 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`
|
BIN
tool/PGListUtil/releases/PGListUtil.exe
Normal file
BIN
tool/PGListUtil/releases/PGListUtil.exe
Normal file
Binary file not shown.
BIN
tool/PGListUtil/releases/PGListUtil_en.exe
Normal file
BIN
tool/PGListUtil/releases/PGListUtil_en.exe
Normal file
Binary file not shown.
10
tool/PGListUtil/releases/README.md
Normal file
10
tool/PGListUtil/releases/README.md
Normal 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)
|
138
tool/PGListUtil/releases/readme.txt
Normal file
138
tool/PGListUtil/releases/readme.txt
Normal 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条件の仕様を変更 (文字列が重なる部分も一致するようにした)
|
||||
ファイルのドラッグ&ドロップを入力ファイルと出力ファイルに分けた
|
||||
|
||||
|
9
tool/PGListUtil/src/PGListUtil/PGListUtil.cpp
Normal file
9
tool/PGListUtil/src/PGListUtil/PGListUtil.cpp
Normal 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;
|
||||
}
|
22
tool/PGListUtil/src/PGListUtil/PGListUtil.exe.manifest
Normal file
22
tool/PGListUtil/src/PGListUtil/PGListUtil.exe.manifest
Normal 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>
|
6
tool/PGListUtil/src/PGListUtil/PGListUtil.h
Normal file
6
tool/PGListUtil/src/PGListUtil/PGListUtil.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef PGLISTUTIL_H
|
||||
#define PGLISTUTIL_H
|
||||
|
||||
extern HINSTANCE hInst;
|
||||
|
||||
#endif // PGLISTUTIL_H
|
191
tool/PGListUtil/src/PGListUtil/ThreadExecute.cpp
Normal file
191
tool/PGListUtil/src/PGListUtil/ThreadExecute.cpp
Normal 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
|
16
tool/PGListUtil/src/PGListUtil/ThreadExecute.h
Normal file
16
tool/PGListUtil/src/PGListUtil/ThreadExecute.h
Normal 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
|
440
tool/PGListUtil/src/PGListUtil/WindowMain.cpp
Normal file
440
tool/PGListUtil/src/PGListUtil/WindowMain.cpp
Normal 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
|
39
tool/PGListUtil/src/PGListUtil/WindowMain.h
Normal file
39
tool/PGListUtil/src/PGListUtil/WindowMain.h
Normal 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
|
42
tool/PGListUtil/src/PGListUtil/resource.h
Normal file
42
tool/PGListUtil/src/PGListUtil/resource.h
Normal 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
|
100
tool/PGListUtil/src/PGListUtil/resource.rc
Normal file
100
tool/PGListUtil/src/PGListUtil/resource.rc
Normal 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"
|
12
tool/PGListUtil/src/PGListUtil/stdafx.h
Normal file
12
tool/PGListUtil/src/PGListUtil/stdafx.h
Normal 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
|
171
tool/PGListUtil/src/common/CErrorList.cpp
Normal file
171
tool/PGListUtil/src/common/CErrorList.cpp
Normal 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
|
43
tool/PGListUtil/src/common/CErrorList.h
Normal file
43
tool/PGListUtil/src/common/CErrorList.h
Normal 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
|
125
tool/PGListUtil/src/common/CFilter.cpp
Normal file
125
tool/PGListUtil/src/common/CFilter.cpp
Normal 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
|
34
tool/PGListUtil/src/common/CFilter.h
Normal file
34
tool/PGListUtil/src/common/CFilter.h
Normal 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
|
355
tool/PGListUtil/src/common/CIpList.cpp
Normal file
355
tool/PGListUtil/src/common/CIpList.cpp
Normal 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
|
56
tool/PGListUtil/src/common/CIpList.h
Normal file
56
tool/PGListUtil/src/common/CIpList.h
Normal 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
|
48
tool/PGListUtil/src/common/common.h
Normal file
48
tool/PGListUtil/src/common/common.h
Normal 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
|
Loading…
Reference in New Issue
Block a user