Skip to content

Instantly share code, notes, and snippets.

@5ila5
Last active July 3, 2024 06:32
Show Gist options
  • Save 5ila5/205672118616e30a2eaccbc89db42df4 to your computer and use it in GitHub Desktop.
Save 5ila5/205672118616e30a2eaccbc89db42df4 to your computer and use it in GitHub Desktop.
app_abfallplus_de debugging
import requests
import random
def random_hex(length: int = 1) -> str:
return "".join(random.choice("0123456789abcdef") for _ in range(length))
client = random_hex(8) + "-" + random_hex(4) + "-" + random_hex(4) + "-" + random_hex(4) + "-" + random_hex(12)
app_id = "de.k4systems.abfallappzak"
DEFAULT_HEADERS = {
"User-Agent": "Android / Abfall App 9.1.3 (1915091030) / DM=sdk_gphone_x86_64;DP=sdk_gphone_x86_64;DN=ranchu;DT=emu64xa;SN=google;SV=13 (33);MF=Google",
"Content-Type": "application/x-www-form-urlencoded",
"Accept-Encoding": "identity",
}
ASSISTANT_HEADERS = {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-US,en;q=0.9",
"Connection": "keep-alive",
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
"Host": "app.abfallplus.de",
"Origin": "https://app.abfallplus.de",
"Referer": "https://app.abfallplus.de/login/",
"Sec-Fetch-Dest": "empty",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Site": "same-origin",
"User-Agent": "Mozilla/5.0 (Linux; Android 13; sdk_gphone_x86_64 Build/TE1A.220922.025; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/103.0.5060.71 Mobile Safari/537.36",
"X-Requested-With": "XMLHttpRequest",
}
data = f"client={client}&app_id=de.k4systems.abfallappzak"
s = requests.Session()
s.post("https://app.abfallplus.de/config.xml", data=data, headers=DEFAULT_HEADERS).raise_for_status()
s.post("https://app.abfallplus.de/login/", data=data, headers=DEFAULT_HEADERS).raise_for_status()
s.post("https://app.abfallplus.de/version.xml", data=data, headers=DEFAULT_HEADERS)
s.get("https://app.abfallplus.de/login/", headers={
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-US,en;q=0.9",
"Connection": "keep-alive",
"Sec-Fetch-Dest": "document",
"Sec-Fetch-Mode": "navigate",
"Sec-Fetch-Site": "none",
"Sec-Fetch-User": "?1",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (Linux; Android 13; sdk_gphone_x86_64 Build/TE1A.220922.025; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/103.0.5060.71 Mobile Safari/537.36",
"X-Requested-With": "de.k4systems.abfallappzak",
}).raise_for_status()
data = "id_landkreis=670|0|ZAK Kempten&awk_href_back=awk_assistent_step_2"
s.post("https://app.abfallplus.de/assistent/kommune/", data=data, headers=ASSISTANT_HEADERS).raise_for_status()
data = "id_landkreis=670|0|ZAK Kempten&id_kommune=2786|0|Fischen&awk_href_back=awk_assistent_step_2"
s.post("https://app.abfallplus.de/assistent/bezirk/", data=data, headers=ASSISTANT_HEADERS).raise_for_status()
data = "f_id_bundesland=247&f_id_landkreis=670|0|ZAK Kempten&f_id_kommune=2786&f_id_bezirk=123|0|Ortsteile&f_id_strasse=124&f_hnr=&f_kdnr="
s.post("https://app.abfallplus.de/assistent/abfallarten/", data=data, headers=ASSISTANT_HEADERS).raise_for_status()
data = "f_id_bundesland=247&f_id_landkreis=670%7C0%7CZAK+Kempten&f_id_kommune=2786&f_id_bezirk=123%7C0%7COrtsteile&f_id_strasse=124&f_hnr=&f_kdnr=&f_id_abfallart%5B%5D=31&ion-tg-1=on&f_id_abfallart%5B%5D=20&ion-tg-6=on&f_id_abfallart%5B%5D=275&ion-tg-4=on&f_id_abfallart%5B%5D=58&ion-tg-0=on&f_id_abfallart%5B%5D=632&ion-tg-5=on&f_id_abfallart%5B%5D=60&ion-tg-2=on&f_id_abfallart%5B%5D=19&ion-tg-3=on&f_uhrzeit_tag=86400%7C0&f_uhrzeit_stunden=50400&f_uhrzeit_minuten=2100&f_email_91a98382928cd2b45afcc9dbc72392b0=&f_anonym=1&f_ausgangspunkt=start&f_ueberspringen=0"
s.post("https://app.abfallplus.de/assistent/ueberpruefen/", data=data, headers=ASSISTANT_HEADERS).raise_for_status()
data = "f_id_bundesland=247&f_id_landkreis=670%7C0%7CZAK+Kempten&f_id_kommune=2786&f_id_bezirk=123%7C0%7COrtsteile&f_id_strasse=124&f_hnr=&f_kdnr=&f_id_abfallart%5B%5D=31&ion-tg-1=on&f_id_abfallart%5B%5D=20&ion-tg-6=on&f_id_abfallart%5B%5D=275&ion-tg-4=on&f_id_abfallart%5B%5D=58&ion-tg-0=on&f_id_abfallart%5B%5D=632&ion-tg-5=on&f_id_abfallart%5B%5D=60&ion-tg-2=on&f_id_abfallart%5B%5D=19&ion-tg-3=on&f_uhrzeit_tag=86400%7C0&f_uhrzeit_stunden=50400&f_uhrzeit_minuten=2100&f_email_91a98382928cd2b45afcc9dbc72392b0=&f_anonym=1&f_ausgangspunkt=start&f_ueberspringen=0&f_datenschutz=20240628225209"
s.post("https://app.abfallplus.de/assistent/finish/", data=data, headers=ASSISTANT_HEADERS).raise_for_status()
s.post("https://app.abfallplus.de/login/", data=data, headers=DEFAULT_HEADERS).raise_for_status()
s.post("https://app.abfallplus.de/version.xml", data=data, headers=DEFAULT_HEADERS).raise_for_status()
s.post("https://app.abfallplus.de/version.xml?renew=1", data=data, headers=DEFAULT_HEADERS).raise_for_status()
r = s.post("https://app.abfallplus.de/struktur.xml.zip", data=data, headers=DEFAULT_HEADERS)
r.raise_for_status()
with open("struktur.xml", "wb") as f:
f.write(r.content)
@MatzzeF
Copy link

MatzzeF commented Jul 1, 2024

@5ila5 when i run this i get a 401 as a result in line 38. could it be that they have modified the login page so that the login is broken now?

@AKGitH
Copy link

AKGitH commented Jul 3, 2024

when I run it, I get a file: struktur.xml

grafik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment