This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # | |
| # Convert pihole domain blacklists to hosts file format. | |
| # | |
| # Usage: | |
| # Create folder ./export | |
| # Create pihole export and extract it to ./export | |
| # Backup can be created in "Settings" > "Teleporter" > "Backup" | |
| # Install requirements with "pip install aiohttp[speedups] tqdm" | |
| # Run script "python pihole_to_hosts.py" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| uint16_t crc16(char* pData, int length) | |
| { | |
| uint8_t i; | |
| uint16_t wCrc = 0xffff; | |
| while (length--) { | |
| wCrc ^= *(unsigned char *)pData++ << 8; | |
| for (i=0; i < 8; i++) | |
| wCrc = wCrc & 0x8000 ? (wCrc << 1) ^ 0x1021 : wCrc << 1; | |
| } | |
| return wCrc & 0xffff; |