-
-
Save Beefysam211/b5db497ae44934ad17389c0b5c088c13 to your computer and use it in GitHub Desktop.
Phrack RSS
This file contains 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
""" | |
phrack-rss.py - Generates a RSS feed for Phrack's releases. | |
Copyright (c) 2016 Carter Yagemann | |
This program is free software: you can redistribute it and/or modify | |
it under the terms of the GNU General Public License as published by | |
the Free Software Foundation, either version 3 of the License, or | |
(at your option) any later version. | |
This program is distributed in the hope that it will be useful, | |
but WITHOUT ANY WARRANTY; without even the implied warranty of | |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
GNU General Public License for more details. | |
A copy of the GNU General Public License is available at | |
<http://www.gnu.org/licenses/>. | |
""" | |
from feedgen.feed import FeedGenerator | |
import re | |
import requests | |
def getnum(s): | |
return int(re.findall('\d+', s)[0]) | |
def gettgzs(): | |
dir = requests.get('http://www.phrack.org/archives/tgz/') | |
if dir.status_code == 200: | |
return sorted(set(re.findall('phrack\d+.tar.gz', dir.text)), key=getnum) | |
else: | |
return [] | |
def makefeed(tgzs): | |
fg = FeedGenerator() | |
fg.id('phrack-rss') | |
fg.title('Phrack News') | |
fg.description('Archive for Phrack News') | |
fg.link(href='http://www.phrack.org/archives/tgz/', rel='alternate') | |
fg.language('en') | |
for tgz in tgzs: | |
fe = fg.add_entry() | |
url = 'http://www.phrack.org/archives/tgz/' + tgz | |
fe.id(url) | |
fe.title(tgz) | |
fe.description('Get ' + tgz + ' at ' + url) | |
fe.content(src=url) | |
fe.link(href=url) | |
return fg | |
tgzs = gettgzs() | |
if len(tgzs) > 0: | |
print makefeed(tgzs).rss_str() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment