-
Notifications
You must be signed in to change notification settings - Fork 0
/
OhlohAddRepos.au3
68 lines (47 loc) · 2.1 KB
/
OhlohAddRepos.au3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.8.1
Author: Gabriel Cossette
Script Function:
Script to batch add Ohloh repositories.
#ce ----------------------------------------------------------------------------
#include <file.au3>
Dim $array
Dim $data
Dim $project
_FileReadToArray("data.txt", $data)
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$project = InputBox("Project name", "Project short name")
$username = InputBox("Username", "Username")
$password = InputBox("Password", "Password")
;LOGIN
;Post request
$oHTTP.Open("POST", "https://www.ohloh.net/sessions", False)
;Add User-Agent header
$oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 4.0.20506)")
;Add Referrer header
$oHTTP.SetRequestHeader("Referrer", "https://www.ohloh.net/sessions/new")
;Add Content-Type
$oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
;Send POST request
$oHTTP.Send("login[login]=" & $username & "&login[password]=" & $password & "&login[remember_me]=1")
;Get received data
;$oReceived = $oHTTP.ResponseText
For $x = 1 To $data[0]
;ADD ENLISTMENT
;Post request
$oHTTP.Open("POST", "https://www.ohloh.net/p/" & $project & "/enlistments", False)
;Add User-Agent header
$oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 4.0.20506)")
;Add Referrer header
$oHTTP.SetRequestHeader("Referrer", "https://www.ohloh.net/p/" & $project & "/enlistments/new")
;Add Content-Type
$oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
;Send POST request
$oHTTP.Send("repository[module_name]=" & $data[$x] & "&repository[type]=CvsRepository&repository[url]=:pserver:anonymous:@cvs.project-open.net:/home/cvsroot")
;Get received data
;$oReceived = $oHTTP.ResponseText
$log = FileOpen("log.txt", 1)
FileWriteLine($log, $data[$x])
FileClose($log)
Sleep(5000)
Next