Skip to content

Commit 002a6c6

Browse files
committed
Merge pull request #9 from DeOldSax/develop
Develop
2 parents 443bc25 + dcd180a commit 002a6c6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+5985
-5938
lines changed

.gitignore

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/bin
2-
/.settings
3-
/.classpath
4-
/.project
5-
/release
6-
/target
1+
/bin
2+
/.settings
3+
/.classpath
4+
/.project
5+
/release
6+
/target

LICENSE

Lines changed: 338 additions & 338 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
Ilias Downloader Tool
2-
===================
3-
4-
Das Ilias Downloader Tool ist unter anderem als Hilfe gedacht, um Dateien aus dem Ilias [ilias.studium.kit.edu](https://ilias.studium.kit.edu)
5-
einfacher zu verwalten und herunterzuladen. Das klicken durch die Ordner im Browser, kann durch langsame oder fehlende Internetverbindung sehr mühsam werden. Bei steigender Anzahl von Ordnern und Kursen im Ilias verliert man leicht den Überblick welche Dokumente man schon lokal vorliegen hat und welche nicht.
6-
<br>**For more Information visit the** [**Website**] (http://iliasdownloadertool.de).
7-
8-
Application
9-
===================
10-
11-
![Image of Application](http://iliasdownloadertool.de/screenshot.png)
12-
13-
Contribute
14-
================
15-
Feel free to contribute!!!
16-
17-
1+
Ilias Downloader Tool
2+
===================
3+
4+
Das Ilias Downloader Tool ist unter anderem als Hilfe gedacht, um Dateien aus dem Ilias [ilias.studium.kit.edu](https://ilias.studium.kit.edu)
5+
einfacher zu verwalten und herunterzuladen. Das klicken durch die Ordner im Browser, kann durch langsame oder fehlende Internetverbindung sehr mühsam werden. Bei steigender Anzahl von Ordnern und Kursen im Ilias verliert man leicht den Überblick welche Dokumente man schon lokal vorliegen hat und welche nicht.
6+
<br>**For more Information visit the** [**Website**] (http://iliasdownloadertool.de).
7+
8+
Application
9+
===================
10+
11+
![Image of Application](http://iliasdownloadertool.de/screenshot.png)
12+
13+
Contribute
14+
================
15+
Feel free to contribute!!!
16+
17+

login.py

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
#!/usr/bin/env python3
2+
import requests
3+
import bs4
4+
import re
5+
6+
import pprint
7+
8+
9+
class Session():
10+
def __init__(self, username, password):
11+
self.session = requests.Session()
12+
self.dashboard_soup = self.login(username, password)
13+
14+
def login(self, username, password):
15+
payload = {"sendLogin": 1,
16+
"idp_selection": "https://idp.scc.kit.edu/idp/shibboleth",
17+
"target": "https://ilias.studium.kit.edu/shib_login.php",
18+
"home_organization_selection": "Mit KIT-Account anmelden"}
19+
response = self.session.post(
20+
"https://ilias.studium.kit.edu/Shibboleth.sso/Login",
21+
data=payload)
22+
23+
soup = bs4.BeautifulSoup(response.text, 'html.parser')
24+
form = soup.find('form', attrs={'class': 'form2', 'method': 'post'})
25+
action = form['action']
26+
27+
# parse and login
28+
credentials = {"_eventId_proceed" : "", "j_username": username, "j_password": password}
29+
url = "https://idp.scc.kit.edu" + action
30+
31+
response = self.session.post(url, data=credentials)
32+
33+
html_doc = response.text
34+
35+
soup = bs4.BeautifulSoup(html_doc, 'html.parser')
36+
relay_state = soup.find('input', attrs={'name': 'RelayState'})
37+
saml_response = soup.find('input', attrs={'name': 'SAMLResponse'})
38+
39+
if not relay_state:
40+
raise Exception('wrong credentials!')
41+
42+
payload = {'RelayState': relay_state['value'],
43+
'SAMLResponse': saml_response['value'],
44+
'_eventId_proceed': ''}
45+
dashboard_html = self.session.post(
46+
"https://ilias.studium.kit.edu/Shibboleth.sso/SAML2/POST",
47+
data=payload).text
48+
49+
return bs4.BeautifulSoup(dashboard_html, 'html.parser')
50+
51+
def get_courses(self):
52+
return self.extract_items(self.dashboard_soup)
53+
54+
def get_content(self, link):
55+
html = self.session.get(link).text
56+
soup = bs4.BeautifulSoup(html, 'html.parser')
57+
return self.extract_items(soup)
58+
59+
def add_subcontent(self, courses, deepness = -1):
60+
for course in courses:
61+
href = course["href"]
62+
if deepness != 0 and re.search("crs|fold", href):
63+
course["content"] = self.get_content(href)
64+
deepness -= 1
65+
self.add_subcontent(course["content"], deepness)
66+
67+
def extract_items(self, soup):
68+
a_tags = soup.find_all('a', class_='il_ContainerItemTitle')
69+
return [self.format_tag(a_tag) for a_tag in a_tags]
70+
71+
def format_tag(self, a_tag):
72+
base_url = "https://ilias.studium.kit.edu/"
73+
74+
href = a_tag["href"]
75+
if not re.match(base_url, href):
76+
href = base_url + href
77+
78+
return {"name": a_tag.contents[0], "href": href}
79+
80+
81+
def parse(username, password):
82+
session = Session(username, password)
83+
courses = session.get_courses()
84+
session.add_subcontent(courses)
85+
return courses
86+
87+
88+
if __name__ == "__main__":
89+
import sys
90+
import pprint
91+
username = sys.argv[1]
92+
password = sys.argv[2]
93+
94+
session = Session(username, password)
95+
courses = session.get_courses()
96+
97+
pprint.pprint(courses)

pom.xml

Lines changed: 116 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -1,116 +1,116 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2-
<modelVersion>4.0.0</modelVersion>
3-
<groupId>deoldsax</groupId>
4-
<artifactId>Ilias</artifactId>
5-
<version>v0.5.0</version>
6-
7-
<properties>
8-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
9-
</properties>
10-
11-
<organization>
12-
<name>DeOldSax</name>
13-
</organization>
14-
15-
<dependencies>
16-
17-
<dependency>
18-
<groupId>junit</groupId>
19-
<artifactId>junit</artifactId>
20-
<version>4.10</version>
21-
</dependency>
22-
23-
<dependency>
24-
<groupId>log4j</groupId>
25-
<artifactId>log4j</artifactId>
26-
<version>1.2.17</version>
27-
</dependency>
28-
29-
<dependency>
30-
<groupId>org.jsoup</groupId>
31-
<artifactId>jsoup</artifactId>
32-
<version>1.7.2</version>
33-
</dependency>
34-
35-
<dependency>
36-
<groupId>org.apache.httpcomponents</groupId>
37-
<artifactId>httpcore</artifactId>
38-
<version>4.2.4</version>
39-
</dependency>
40-
41-
<dependency>
42-
<groupId>org.apache.httpcomponents</groupId>
43-
<artifactId>httpclient</artifactId>
44-
<version>4.2.5</version>
45-
</dependency>
46-
47-
<dependency>
48-
<groupId>commons-logging</groupId>
49-
<artifactId>commons-logging</artifactId>
50-
<version>1.1.1</version>
51-
</dependency>
52-
53-
<dependency>
54-
<groupId>org.controlsfx</groupId>
55-
<artifactId>controlsfx</artifactId>
56-
<version>8.20.8</version>
57-
</dependency>
58-
59-
</dependencies>
60-
61-
<build>
62-
<plugins>
63-
64-
<plugin>
65-
<artifactId>maven-assembly-plugin</artifactId>
66-
<executions>
67-
<execution>
68-
<phase>package</phase>
69-
<goals>
70-
<goal>single</goal>
71-
</goals>
72-
<configuration>
73-
<descriptorRefs>
74-
<descriptorRef>jar-with-dependencies</descriptorRef>
75-
</descriptorRefs>
76-
<archive>
77-
<manifest>
78-
<mainClass>view.Dashboard</mainClass>
79-
</manifest>
80-
</archive>
81-
</configuration>
82-
</execution>
83-
</executions>
84-
</plugin>
85-
86-
<plugin>
87-
<artifactId>maven-antrun-plugin</artifactId>
88-
<version>1.7</version>
89-
<executions>
90-
<execution>
91-
<phase>install</phase>
92-
<goals>
93-
<goal>run</goal>
94-
</goals>
95-
<configuration>
96-
<tasks>
97-
<copy file="target/Ilias-${project.version}-jar-with-dependencies.jar"
98-
tofile="release/IliasDownloaderTool-${project.version}/Ilias-${project.version}.jar">
99-
</copy>
100-
</tasks>
101-
</configuration>
102-
</execution>
103-
</executions>
104-
</plugin>
105-
<plugin>
106-
<groupId>org.apache.maven.plugins</groupId>
107-
<artifactId>maven-compiler-plugin</artifactId>
108-
<configuration>
109-
<source>1.8</source>
110-
<target>1.8</target>
111-
</configuration>
112-
</plugin>
113-
114-
</plugins>
115-
</build>
116-
</project>
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<modelVersion>4.0.0</modelVersion>
3+
<groupId>deoldsax</groupId>
4+
<artifactId>Ilias</artifactId>
5+
<version>v0.6.0</version>
6+
7+
<properties>
8+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
9+
</properties>
10+
11+
<organization>
12+
<name>DeOldSax</name>
13+
</organization>
14+
15+
<dependencies>
16+
17+
<dependency>
18+
<groupId>junit</groupId>
19+
<artifactId>junit</artifactId>
20+
<version>4.10</version>
21+
</dependency>
22+
23+
<dependency>
24+
<groupId>log4j</groupId>
25+
<artifactId>log4j</artifactId>
26+
<version>1.2.17</version>
27+
</dependency>
28+
29+
<dependency>
30+
<groupId>org.jsoup</groupId>
31+
<artifactId>jsoup</artifactId>
32+
<version>1.7.2</version>
33+
</dependency>
34+
35+
<dependency>
36+
<groupId>org.apache.httpcomponents</groupId>
37+
<artifactId>httpcore</artifactId>
38+
<version>4.2.4</version>
39+
</dependency>
40+
41+
<dependency>
42+
<groupId>org.apache.httpcomponents</groupId>
43+
<artifactId>httpclient</artifactId>
44+
<version>4.2.5</version>
45+
</dependency>
46+
47+
<dependency>
48+
<groupId>commons-logging</groupId>
49+
<artifactId>commons-logging</artifactId>
50+
<version>1.1.1</version>
51+
</dependency>
52+
53+
<dependency>
54+
<groupId>org.controlsfx</groupId>
55+
<artifactId>controlsfx</artifactId>
56+
<version>8.20.8</version>
57+
</dependency>
58+
59+
</dependencies>
60+
61+
<build>
62+
<plugins>
63+
64+
<plugin>
65+
<artifactId>maven-assembly-plugin</artifactId>
66+
<executions>
67+
<execution>
68+
<phase>package</phase>
69+
<goals>
70+
<goal>single</goal>
71+
</goals>
72+
<configuration>
73+
<descriptorRefs>
74+
<descriptorRef>jar-with-dependencies</descriptorRef>
75+
</descriptorRefs>
76+
<archive>
77+
<manifest>
78+
<mainClass>view.Dashboard</mainClass>
79+
</manifest>
80+
</archive>
81+
</configuration>
82+
</execution>
83+
</executions>
84+
</plugin>
85+
86+
<plugin>
87+
<artifactId>maven-antrun-plugin</artifactId>
88+
<version>1.7</version>
89+
<executions>
90+
<execution>
91+
<phase>install</phase>
92+
<goals>
93+
<goal>run</goal>
94+
</goals>
95+
<configuration>
96+
<tasks>
97+
<copy file="target/Ilias-${project.version}-jar-with-dependencies.jar"
98+
tofile="release/IliasDownloaderTool-${project.version}/Ilias-${project.version}.jar">
99+
</copy>
100+
</tasks>
101+
</configuration>
102+
</execution>
103+
</executions>
104+
</plugin>
105+
<plugin>
106+
<groupId>org.apache.maven.plugins</groupId>
107+
<artifactId>maven-compiler-plugin</artifactId>
108+
<configuration>
109+
<source>1.8</source>
110+
<target>1.8</target>
111+
</configuration>
112+
</plugin>
113+
114+
</plugins>
115+
</build>
116+
</project>

0 commit comments

Comments
 (0)