├── .gitattributes
├── .gitignore
├── BitSnoop
├── BitSnoopHTML2MySQL
│ ├── BitSnoopHTML2MySQL.cbp
│ ├── BitSnoopHTML2MySQL.layout
│ ├── Remove-Delete Duplicate Lines (to check if my programm works).url
│ └── main.cpp
├── BitSnoopHTMLLinkCreator
│ ├── BitSnoopLinkCreator.cbp
│ ├── BitSnoopLinkCreator.depend
│ ├── BitSnoopLinkCreator.layout
│ └── main.cpp
├── BitSnoopHTMLScan
│ ├── BitSnoopHTMLScan.cbp
│ ├── BitSnoopHTMLScan.depend
│ ├── BitSnoopHTMLScan.layout
│ ├── Remove-Delete Duplicate Lines (to check if my programm works).url
│ ├── main.cpp
│ └── main_standartsuche.cpp
├── BitSnoopMaxPagesScan
│ ├── BitSnoopMaxPagesScan.cbp
│ ├── BitSnoopMaxPagesScan.depend
│ ├── BitSnoopMaxPagesScan.layout
│ └── main.cpp
└── BitSnoopRSSLinkCreator
│ ├── BitSnoopLinkCreator.cbp
│ ├── BitSnoopLinkCreator.depend
│ ├── BitSnoopLinkCreator.layout
│ └── main.cpp
├── ExtraTorrent
└── ExtraTorrentCopy
│ ├── ExtraTorrentCopy.cbp
│ └── main.cpp
├── IsoHunt
├── IsoHuntCopy
│ ├── IsoHuntCopy.cbp
│ ├── IsoHuntCopy.depend
│ ├── IsoHuntCopy.layout
│ └── main.cpp
└── IsoHuntMagnet
│ ├── IsoHuntMagnet.cbp
│ ├── IsoHuntMagnet.depend
│ ├── IsoHuntMagnet.layout
│ └── main.cpp
├── Kickass api to Openbay
├── KickassFullDump.sh
└── KickassUpdater.sh
├── Kickass
├── KickassHTML2MySQL
│ ├── KickassHTML2MySQL.cbp
│ ├── KickassHTML2MySQL.layout
│ ├── Remove-Delete Duplicate Lines (to check if my programm works).url
│ └── main.cpp
├── KickassHTMLScan
│ ├── KickassHTMLScan.cbp
│ ├── KickassHTMLScan.depend
│ ├── KickassHTMLScan.layout
│ ├── Remove-Delete Duplicate Lines (to check if my programm works).url
│ ├── main.cpp
│ └── main_standartsuche.cpp
├── KickassLinkCreator
│ ├── KickassLinkCreator.cbp
│ ├── KickassLinkCreator.depend
│ ├── KickassLinkCreator.layout
│ └── main.cpp
└── KickassMaxPagesScan
│ ├── KickassMaxPagesScan.cbp
│ ├── KickassMaxPagesScan.depend
│ ├── KickassMaxPagesScan.layout
│ └── main.cpp
├── LICENSE
├── Notes
├── Create_Kickass_V2_DB.txt
├── How_to_import.txt
└── Notes.txt
├── PirateBay
├── main.cpp
├── oldpiratebayCopy.cbp
├── oldpiratebayCopy.depend
└── oldpiratebayCopy.layout
├── README.md
├── Tools
├── AddTerminated2api
│ └── main.cpp
├── DB_RSS-Feed updater.rar
├── Magnet2Torrent C++
│ ├── Bencode.cpp
│ ├── Bencode.h
│ ├── BencodeLibrary.dll
│ ├── Magnet2Torrent.cbp
│ ├── Magnet2Torrent.depend
│ ├── Magnet2Torrent.layout
│ └── main.cpp
├── NoSQLDublicates
│ ├── NoSQLDublicates.cbp
│ ├── NoSQLDublicates.depend
│ ├── NoSQLDublicates.layout
│ └── main.cpp
├── Simple Text Splitter v0.5
│ ├── GPL.txt
│ ├── Readme.txt
│ └── src.zip
└── torrent2magnet python
│ ├── .gitignore
│ ├── LICENSE
│ ├── bencode.py
│ ├── recursive list files in a dir using Python - ~ Mayank Johri's Tips ~.url
│ ├── repolho-torrent2magnet.url
│ ├── torrent2magnet.py
│ └── torrentinfo (unused).py
├── Torrentz
├── TorrentzCopy
│ ├── Torrentz.cbp
│ ├── Torrentz.depend
│ ├── Torrentz.layout
│ ├── get.bat
│ └── main.cpp
├── TorrentzHTML2MySQL
│ ├── Torrentz.cbp
│ ├── Torrentz.depend
│ ├── Torrentz.layout
│ ├── get.bat
│ └── main.cpp
└── UpdateTorrentProject
│ ├── main.cpp
│ ├── update.bat
│ └── update_manual_download.bat
└── oldpiratebayCopy
├── main.cpp
├── oldpiratebayCopy.cbp
├── oldpiratebayCopy.depend
└── oldpiratebayCopy.layout
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 | *.sln merge=union
7 | *.csproj merge=union
8 | *.vbproj merge=union
9 | *.fsproj merge=union
10 | *.dbproj merge=union
11 |
12 | # Standard to msysgit
13 | *.doc diff=astextplain
14 | *.DOC diff=astextplain
15 | *.docx diff=astextplain
16 | *.DOCX diff=astextplain
17 | *.dot diff=astextplain
18 | *.DOT diff=astextplain
19 | *.pdf diff=astextplain
20 | *.PDF diff=astextplain
21 | *.rtf diff=astextplain
22 | *.RTF diff=astextplain
23 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Windows image file caches
2 | Thumbs.db
3 | ehthumbs.db
4 |
5 | # Folder config file
6 | Desktop.ini
7 |
8 | # Recycle Bin used on file shares
9 | $RECYCLE.BIN/
10 |
11 | # Windows Installer files
12 | *.cab
13 | *.msi
14 | *.msm
15 | *.msp
16 |
17 | # =========================
18 | # Operating System Files
19 | # =========================
20 |
21 | # OSX
22 | # =========================
23 |
24 | .DS_Store
25 | .AppleDouble
26 | .LSOverride
27 |
28 | # Icon must end with two \r
29 | Icon
30 |
31 | # Thumbnails
32 | ._*
33 |
34 | # Files that might appear on external disk
35 | .Spotlight-V100
36 | .Trashes
37 |
38 | # Directories potentially created on remote AFP share
39 | .AppleDB
40 | .AppleDesktop
41 | Network Trash Folder
42 | Temporary Items
43 | .apdisk
44 |
--------------------------------------------------------------------------------
/BitSnoop/BitSnoopHTML2MySQL/BitSnoopHTML2MySQL.cbp:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/BitSnoop/BitSnoopHTML2MySQL/BitSnoopHTML2MySQL.layout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/BitSnoop/BitSnoopHTML2MySQL/Remove-Delete Duplicate Lines (to check if my programm works).url:
--------------------------------------------------------------------------------
1 | [InternetShortcut]
2 | URL=http://textmechanic.com/Remove-Duplicate-Lines.html
3 |
--------------------------------------------------------------------------------
/BitSnoop/BitSnoopHTML2MySQL/main.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicoboss/KickassCopy/52fdff61c67d603d6f07912fcd8658f5fa1ec2f3/BitSnoop/BitSnoopHTML2MySQL/main.cpp
--------------------------------------------------------------------------------
/BitSnoop/BitSnoopHTMLLinkCreator/BitSnoopLinkCreator.cbp:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/BitSnoop/BitSnoopHTMLLinkCreator/BitSnoopLinkCreator.depend:
--------------------------------------------------------------------------------
1 | # depslib dependency file v1.0
2 | 1418768905 source:c:\users\nico_000\documents\github\kickasscopy\kickasslinkcreator\main.cpp
3 |
4 |
5 |
6 | "windows.h"
7 |
8 |
9 |
10 | 1418929818 source:e:\documents\github\kickasscopy\kickasslinkcreator\main.cpp
11 |
12 |
13 |
14 | "windows.h"
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/BitSnoop/BitSnoopHTMLLinkCreator/BitSnoopLinkCreator.layout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/BitSnoop/BitSnoopHTMLLinkCreator/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include "windows.h"
5 | #include
6 | #include
7 |
8 | using namespace std;
9 |
10 | bool Read_MaxPagesFile(void);
11 | void brute5(void);
12 | bool next(string& x);
13 |
14 |
15 | vector MaxPages;
16 | vector MaxPages_Organisation;
17 | unsigned long MaxPages_length=0;
18 | bool MaxPages_out_of_range=false;
19 |
20 |
21 | //https://kickass.so/usearch/cds/
22 |
23 | int main()
24 | {
25 | //ShellExecute(0, "open", "curl", "https://kickass.so/", 0, SW_SHOWNORMAL);
26 | //ShellExecute(NULL, "open", "curl.exe", "https://kickass.so/the-good-lie-2014-720p-brrip-x264-yify-t9946721.html", NULL, SW_SHOWNORMAL);
27 | brute5();
28 |
29 | /*
30 | Bug Fixed!
31 | if(MaxPages_out_of_range==true and MaxPages_length>0)
32 | {
33 | cout << "Warning:\nThe length of MaxPages has exceeded and gave an an out_of_range error.\n"
34 | << "For the missing values was used the defult value of 20 pages. Are you sure,\n"
35 | << "that you have analyced every file? Maybe the order is also incorrect.\n"
36 | << "In this case it is beather to delete the MaxPages.txt\n"
37 | << "file and take for every value the defult value.\n"
38 | << "But the best thing is stil a working MaxPages.txt file." << endl;
39 | }
40 | */
41 |
42 | cout << "\nDone!" << endl;
43 | cout << "Press ENTER to close the program" << endl;
44 | cin.get();
45 | return 0;
46 | }
47 |
48 |
49 |
50 | void brute5(void)
51 | {
52 | unsigned long Pos=0;
53 | int i_max;
54 | fstream fs;
55 | fs.open ("BitSnoop_for_HTtrack.txt", fstream::out);
56 | string brute="http://bitsnoop.com/search/all/000";//('a', 48);
57 | do {
58 | //ShellExecute(NULL, "open", "document.doc", NULL, NULL, SW_SHOWNORMAL);
59 | if(brute[brute.length()-1]<'a' or brute[brute.length()-2]<'a' or brute[brute.length()-3]<'a') //Nubers in conbination only mod
60 | {
61 | //cout << brute << endl; //endl is better because Buffer Overvlow but slower than << "\n"! The Best thinng is to don't show anything!
62 | //cout << MaxPages_Organisation.at(Pos) << endl;
63 | //cout << brute.substr(brute.length()-3) << endl;
64 | //cin.get();
65 | //if(MaxPages_length>Pos and MaxPages_Organisation.at(Pos)==brute.substr(brute.length()-3))
66 | //i_max=MaxPages.at(Pos);
67 | //fs << brute << "/" << endl;
68 | cout << brute << "/c/d/1/" << endl;
69 | fs << brute << "/c/d/1/" << endl;
70 | cout << brute << "/c/d/1/" << endl;
71 | //fs << brute << "/" << endl;
72 |
73 | Pos++;
74 |
75 | //cout << "a";
76 | }
77 |
78 | if(brute=="http://bitsnoop.com/search/all/zzz")
79 | {
80 | cout << brute << "/c/d/1/" << endl;
81 | fs << brute << "/c/d/1/" << endl;
82 | fs.close();
83 | return;
84 | }
85 |
86 | //if (hash(brute) == desired_hash)
87 | //return make_pair(true, brute);
88 | }
89 | while(next(brute));
90 | fs.close();
91 | return;
92 | }
93 |
94 |
95 | //http://www.cplusplus.com/forum/general/102786/
96 | bool next(string& x)
97 | {
98 | size_t len = x.size();
99 | bool overflow = true;
100 | while(overflow) {
101 | overflow = false;
102 | if(--len == 0)
103 | return false;
104 | (x[len] == 'z')?(overflow = true, x[len] = '0'):x[len] += 1;
105 | if(x[len]==':')
106 | x[len] += 39;
107 | }
108 | return true;
109 | }
110 |
--------------------------------------------------------------------------------
/BitSnoop/BitSnoopHTMLScan/BitSnoopHTMLScan.cbp:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/BitSnoop/BitSnoopHTMLScan/BitSnoopHTMLScan.depend:
--------------------------------------------------------------------------------
1 | # depslib dependency file v1.0
2 | 1418554732 source:e:\documents\github\kickasscopy\kickasshtmlscan\main.cpp
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | 1418424267 source:c:\users\nico_000\documents\github\kickasscopy\kickasshtmlscan\main.cpp
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | 1422642019 source:e:\documents\github\kickasscopy\bitsnoop\bitsnoophtmlscan\main.cpp
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/BitSnoop/BitSnoopHTMLScan/BitSnoopHTMLScan.layout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/BitSnoop/BitSnoopHTMLScan/Remove-Delete Duplicate Lines (to check if my programm works).url:
--------------------------------------------------------------------------------
1 | [InternetShortcut]
2 | URL=http://textmechanic.com/Remove-Duplicate-Lines.html
3 |
--------------------------------------------------------------------------------
/BitSnoop/BitSnoopHTMLScan/main.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicoboss/KickassCopy/52fdff61c67d603d6f07912fcd8658f5fa1ec2f3/BitSnoop/BitSnoopHTMLScan/main.cpp
--------------------------------------------------------------------------------
/BitSnoop/BitSnoopHTMLScan/main_standartsuche.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicoboss/KickassCopy/52fdff61c67d603d6f07912fcd8658f5fa1ec2f3/BitSnoop/BitSnoopHTMLScan/main_standartsuche.cpp
--------------------------------------------------------------------------------
/BitSnoop/BitSnoopMaxPagesScan/BitSnoopMaxPagesScan.cbp:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/BitSnoop/BitSnoopMaxPagesScan/BitSnoopMaxPagesScan.depend:
--------------------------------------------------------------------------------
1 | # depslib dependency file v1.0
2 | 1422642020 source:e:\documents\github\kickasscopy\bitsnoop\bitsnoopmaxpagesscan\main.cpp
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/BitSnoop/BitSnoopMaxPagesScan/BitSnoopMaxPagesScan.layout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/BitSnoop/BitSnoopMaxPagesScan/main.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicoboss/KickassCopy/52fdff61c67d603d6f07912fcd8658f5fa1ec2f3/BitSnoop/BitSnoopMaxPagesScan/main.cpp
--------------------------------------------------------------------------------
/BitSnoop/BitSnoopRSSLinkCreator/BitSnoopLinkCreator.cbp:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/BitSnoop/BitSnoopRSSLinkCreator/BitSnoopLinkCreator.depend:
--------------------------------------------------------------------------------
1 | # depslib dependency file v1.0
2 | 1418768905 source:c:\users\nico_000\documents\github\kickasscopy\kickasslinkcreator\main.cpp
3 |
4 |
5 |
6 | "windows.h"
7 |
8 |
9 |
10 | 1418929818 source:e:\documents\github\kickasscopy\kickasslinkcreator\main.cpp
11 |
12 |
13 |
14 | "windows.h"
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/BitSnoop/BitSnoopRSSLinkCreator/BitSnoopLinkCreator.layout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/BitSnoop/BitSnoopRSSLinkCreator/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include "windows.h"
5 | #include
6 | #include
7 |
8 | using namespace std;
9 |
10 | bool Read_MaxPagesFile(void);
11 | void brute5(void);
12 | bool next(string& x);
13 |
14 |
15 | vector MaxPages;
16 | vector MaxPages_Organisation;
17 | unsigned long MaxPages_length=0;
18 | bool MaxPages_out_of_range=false;
19 |
20 |
21 | //https://kickass.so/usearch/cds/
22 |
23 | int main()
24 | {
25 | Read_MaxPagesFile();
26 | //ShellExecute(0, "open", "curl", "https://kickass.so/", 0, SW_SHOWNORMAL);
27 | //ShellExecute(NULL, "open", "curl.exe", "https://kickass.so/the-good-lie-2014-720p-brrip-x264-yify-t9946721.html", NULL, SW_SHOWNORMAL);
28 | brute5();
29 |
30 | /*
31 | Bug Fixed!
32 | if(MaxPages_out_of_range==true and MaxPages_length>0)
33 | {
34 | cout << "Warning:\nThe length of MaxPages has exceeded and gave an an out_of_range error.\n"
35 | << "For the missing values was used the defult value of 20 pages. Are you sure,\n"
36 | << "that you have analyced every file? Maybe the order is also incorrect.\n"
37 | << "In this case it is beather to delete the MaxPages.txt\n"
38 | << "file and take for every value the defult value.\n"
39 | << "But the best thing is stil a working MaxPages.txt file." << endl;
40 | }
41 | */
42 |
43 | cout << "\nDone!" << endl;
44 | cout << "Press ENTER to close the program" << endl;
45 | cin.get();
46 | return 0;
47 | }
48 |
49 |
50 |
51 | bool Read_MaxPagesFile(void)
52 | {
53 | char line[8];
54 | string line_string;
55 | ifstream infile ("MaxPages.txt", ios::in);
56 | if (!infile)
57 | {
58 | MaxPages_length=0;
59 | cout << "Warning: MaxPages.txt does not exist!\nAre you sur that you had created one with MaxPagesScan and\ncopyed it into this programm Folder?\n" <<
60 | "For this progress the defult value of 20 pages will be tacken for every\ncombination, but you'll have a lot of dublications and missing Links!\n" << endl;
61 | return false;
62 | }
63 |
64 | while (infile.getline(line, 8))
65 | {
66 | line_string=line;
67 | //cout << line_string.substr(0,3) << endl;
68 | //cout << line_string.substr(4,line_string.length()-4) << endl;
69 | MaxPages_Organisation.push_back(line_string.substr(0,3));
70 | MaxPages.push_back(atoi(line_string.substr(4).c_str()));
71 | //cout << line << endl;
72 | }
73 | MaxPages_length=MaxPages.size();
74 | return true;
75 | }
76 |
77 |
78 | void brute5(void)
79 | {
80 | unsigned long Pos=0;
81 | int i_max;
82 | fstream fs;
83 | fs.open ("BitSnoop_for_HTtrack.txt", fstream::out);
84 | string brute="http://bitsnoop.com/search/all/000";//('a', 48);
85 | do {
86 | //ShellExecute(NULL, "open", "document.doc", NULL, NULL, SW_SHOWNORMAL);
87 | if(brute[brute.length()-1]<'a' or brute[brute.length()-2]<'a' or brute[brute.length()-3]<'a') //Nubers in conbination only mod
88 | {
89 | //cout << brute << endl; //endl is better because Buffer Overvlow but slower than << "\n"! The Best thinng is to don't show anything!
90 | //cout << MaxPages_Organisation.at(Pos) << endl;
91 | //cout << brute.substr(brute.length()-3) << endl;
92 | //cin.get();
93 | if(MaxPages_length>Pos and MaxPages_Organisation.at(Pos)==brute.substr(brute.length()-3))
94 | {
95 | i_max=MaxPages.at(Pos);
96 | //fs << brute << "/" << endl;
97 | for(int i=1; i<=i_max; i++)
98 | {
99 | fs << brute << "/c/d/" << i << "/?fmt=rss" << endl;
100 | cout << brute << "/c/d/" << i << "/?fmt=rss" << endl;
101 | //fs << brute << "/" << endl;
102 | }
103 | Pos++;
104 | }
105 | //cout << "a";
106 | }
107 |
108 | if(brute=="http://bitsnoop.com/search/all/zzz")
109 | {
110 | fs.close();
111 | return;
112 | }
113 |
114 | //if (hash(brute) == desired_hash)
115 | //return make_pair(true, brute);
116 | }
117 | while(next(brute));
118 | fs.close();
119 | return;
120 | }
121 |
122 |
123 | //http://www.cplusplus.com/forum/general/102786/
124 | bool next(string& x)
125 | {
126 | size_t len = x.size();
127 | bool overflow = true;
128 | while(overflow) {
129 | overflow = false;
130 | if(--len == 0)
131 | return false;
132 | (x[len] == 'z')?(overflow = true, x[len] = '0'):x[len] += 1;
133 | if(x[len]==':')
134 | x[len] += 39;
135 | }
136 | return true;
137 | }
138 |
--------------------------------------------------------------------------------
/ExtraTorrent/ExtraTorrentCopy/ExtraTorrentCopy.cbp:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/ExtraTorrent/ExtraTorrentCopy/main.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicoboss/KickassCopy/52fdff61c67d603d6f07912fcd8658f5fa1ec2f3/ExtraTorrent/ExtraTorrentCopy/main.cpp
--------------------------------------------------------------------------------
/IsoHunt/IsoHuntCopy/IsoHuntCopy.cbp:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/IsoHunt/IsoHuntCopy/IsoHuntCopy.depend:
--------------------------------------------------------------------------------
1 | # depslib dependency file v1.0
2 | 1418753633 source:e:\documents\github\kickasscopy\isohuntcopy\main.cpp
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/IsoHunt/IsoHuntCopy/IsoHuntCopy.layout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/IsoHunt/IsoHuntCopy/main.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicoboss/KickassCopy/52fdff61c67d603d6f07912fcd8658f5fa1ec2f3/IsoHunt/IsoHuntCopy/main.cpp
--------------------------------------------------------------------------------
/IsoHunt/IsoHuntMagnet/IsoHuntMagnet.cbp:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/IsoHunt/IsoHuntMagnet/IsoHuntMagnet.depend:
--------------------------------------------------------------------------------
1 | # depslib dependency file v1.0
2 | 1418590043 source:e:\documents\github\kickasscopy\isohuntmagnet\main.cpp
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/IsoHunt/IsoHuntMagnet/IsoHuntMagnet.layout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/IsoHunt/IsoHuntMagnet/main.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicoboss/KickassCopy/52fdff61c67d603d6f07912fcd8658f5fa1ec2f3/IsoHunt/IsoHuntMagnet/main.cpp
--------------------------------------------------------------------------------
/Kickass api to Openbay/KickassFullDump.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | MySQL_username='root'
3 | MySQL_password=''
4 | kickass_userhash=''
5 |
6 | #Downloading update database using the kickass api. Pleas register and send a request to get api access.
7 | cd /root
8 | rm -f dailydump.txt.gz
9 | wget -O 'dailydump.txt.gz' --post-data "userhash=$kickass_userhash" 'https://kat.cr/api/get_dump/daily/'
10 | gzip -fd dailydump.txt.gz
11 | rm -f dailydump.txt.gz
12 |
13 | #Import the txt file and convert it into the openbay format.
14 | mysql --local-infile=1 --user=$MySQL_username --password=$MySQL_password << "EOF"
15 |
16 | SET GLOBAL local_infile = 'ON';
17 | CREATE DATABASE IF NOT EXISTS kickass
18 | DEFAULT CHARACTER SET utf8
19 | DEFAULT COLLATE utf8_general_ci;
20 | USE kickass;
21 |
22 | DROP TABLE IF EXISTS `torrents`;
23 | CREATE TABLE `torrents` (
24 | `id` int(11) unsigned NOT NULL,
25 | `name` varchar(255) DEFAULT NULL,
26 | `description` text,
27 | `category_id` tinyint(4) DEFAULT '7',
28 | `size` bigint(20) unsigned DEFAULT NULL,
29 | `hash` varchar(40) NOT NULL,
30 | `files_count` int(11) DEFAULT '0',
31 | `created_at` datetime DEFAULT NULL,
32 | `torrent_status` tinyint(1) DEFAULT '0',
33 | `visible_status` tinyint(1) DEFAULT '1',
34 | `downloads_count` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'umax = 16777215',
35 | `scrape_date` datetime DEFAULT NULL,
36 | `seeders` mediumint(8) unsigned NOT NULL DEFAULT '0',
37 | `leechers` mediumint(8) unsigned NOT NULL DEFAULT '0',
38 | `tags` varchar(500) DEFAULT NULL,
39 | `updated_at` datetime DEFAULT NULL
40 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
41 |
42 | ALTER TABLE `torrents`
43 | ADD PRIMARY KEY (`id`);
44 | ALTER TABLE `torrents`
45 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
46 |
47 | LOAD DATA LOCAL INFILE '/root/dailydump.txt'
48 | INTO TABLE torrents
49 | FIELDS TERMINATED BY '|'
50 | LINES TERMINATED BY '\n'
51 | (hash,name,tags,@dummy,@dummy,size,@dummy,files_count,seeders,leechers,@upload_date,torrent_status)
52 | set created_at = FROM_UNIXTIME(@upload_date);
53 |
54 | DELETE FROM `torrents` WHERE LENGTH(`hash`)<>40;
55 | DELETE FROM `torrents` WHERE `name`='';
56 | UPDATE `torrents` SET scrape_date=created_at;
57 | UPDATE `torrents` SET description='' WHERE description IS NULL;
58 | UPDATE `torrents` SET category_id=1 WHERE tags='Anime';
59 | UPDATE `torrents` SET category_id=2 WHERE tags='Applications';
60 | UPDATE `torrents` SET category_id=3 WHERE tags='Games';
61 | UPDATE `torrents` SET category_id=4 WHERE tags='XXX';
62 | UPDATE `torrents` SET category_id=5 WHERE tags='Movies';
63 | UPDATE `torrents` SET category_id=6 WHERE tags='Music';
64 | UPDATE `torrents` SET category_id=8 WHERE tags='TV';
65 | UPDATE `torrents` SET category_id=9 WHERE tags='Books';
66 | ALTER IGNORE TABLE `torrents` ADD UNIQUE (`hash`);
67 | quit
68 | EOF
69 |
70 | rm -f dailydump.txt
71 | echo done
72 |
--------------------------------------------------------------------------------
/Kickass api to Openbay/KickassUpdater.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | MySQL_username='root'
3 | MySQL_password=''
4 | kickass_userhash=''
5 |
6 | #Downloading update database using the kickass api. Pleas register and send a request to get api access.
7 | cd /root
8 | rm -f hourlydump.txt.gz
9 | wget -O 'hourlydump.txt.gz' --post-data "userhash=$kickass_userhash" 'https://kat.cr/api/get_dump/hourly/'
10 | gzip -fd hourlydump.txt.gz
11 | rm -f hourlydump.txt.gz
12 |
13 | #Import the txt update file into a temporary database and convert this into the openbay format.
14 | mysql --local-infile=1 --user=$MySQL_username --password=$MySQL_password << "EOF"
15 |
16 | SET GLOBAL local_infile = 'ON';
17 | CREATE DATABASE IF NOT EXISTS kickass
18 | DEFAULT CHARACTER SET utf8
19 | DEFAULT COLLATE utf8_general_ci;
20 | USE kickass;
21 |
22 | DROP TABLE IF EXISTS `update`;
23 | CREATE TABLE IF NOT EXISTS `update` (
24 | `id` int(11) unsigned NOT NULL,
25 | `name` varchar(255) DEFAULT NULL,
26 | `description` text,
27 | `category_id` tinyint(4) DEFAULT '7',
28 | `size` bigint(20) unsigned DEFAULT NULL,
29 | `hash` varchar(40) NOT NULL,
30 | `files_count` int(11) DEFAULT '0',
31 | `created_at` datetime DEFAULT NULL,
32 | `torrent_status` tinyint(1) DEFAULT '0',
33 | `visible_status` tinyint(1) DEFAULT '1',
34 | `downloads_count` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'umax = 16777215',
35 | `scrape_date` datetime DEFAULT NULL,
36 | `seeders` mediumint(8) unsigned NOT NULL DEFAULT '0',
37 | `leechers` mediumint(8) unsigned NOT NULL DEFAULT '0',
38 | `tags` varchar(500) DEFAULT NULL,
39 | `updated_at` datetime DEFAULT NULL
40 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
41 |
42 | ALTER TABLE `update`
43 | ADD PRIMARY KEY (`id`);
44 | ALTER TABLE `update`
45 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
46 |
47 | LOAD DATA LOCAL INFILE '/root/hourlydump.txt'
48 | INTO TABLE `update`
49 | FIELDS TERMINATED BY '|'
50 | LINES TERMINATED BY '\n'
51 | (hash,name,tags,@dummy,@dummy,size,@dummy,files_count,seeders,leechers,@upload_date,torrent_status)
52 | set created_at = FROM_UNIXTIME(@upload_date);
53 |
54 | DELETE FROM `update` WHERE LENGTH(`hash`)<>40;
55 | DELETE FROM `update` WHERE `name`='';
56 | UPDATE `update` SET scrape_date=created_at;
57 | UPDATE `update` SET description='' WHERE description IS NULL;
58 | UPDATE `update` SET category_id=1 WHERE tags='Anime';
59 | UPDATE `update` SET category_id=2 WHERE tags='Applications';
60 | UPDATE `update` SET category_id=3 WHERE tags='Games';
61 | UPDATE `update` SET category_id=4 WHERE tags='XXX';
62 | UPDATE `update` SET category_id=5 WHERE tags='Movies';
63 | UPDATE `update` SET category_id=6 WHERE tags='Music';
64 | UPDATE `update` SET category_id=8 WHERE tags='TV';
65 | UPDATE `update` SET category_id=9 WHERE tags='Books';
66 |
67 | ALTER IGNORE TABLE `update` ADD UNIQUE (`hash`);
68 |
69 | #Copy the temporary into the main database and ignore dublicates
70 | INSERT IGNORE INTO `torrents` (`name`, `description`, `category_id`, `size`, `hash`, `files_count`, `created_at`, `torrent_status`, `visible_status`, `downloads_count`, `scrape_date`, `seeders`, `leechers`, `tags`, `updated_at`)
71 | SELECT `name`, `description`, `category_id`, `size`, `hash`, `files_count`, `created_at`, `torrent_status`, `visible_status`, `downloads_count`, `scrape_date`, `seeders`, `leechers`, `tags`, `updated_at`
72 | FROM `update`;
73 | DROP TABLE IF EXISTS `update`;
74 | quit
75 | EOF
76 |
77 | rm -f dailydump.txt
78 | echo done
79 |
--------------------------------------------------------------------------------
/Kickass/KickassHTML2MySQL/KickassHTML2MySQL.cbp:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/Kickass/KickassHTML2MySQL/KickassHTML2MySQL.layout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Kickass/KickassHTML2MySQL/Remove-Delete Duplicate Lines (to check if my programm works).url:
--------------------------------------------------------------------------------
1 | [InternetShortcut]
2 | URL=http://textmechanic.com/Remove-Duplicate-Lines.html
3 |
--------------------------------------------------------------------------------
/Kickass/KickassHTML2MySQL/main.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicoboss/KickassCopy/52fdff61c67d603d6f07912fcd8658f5fa1ec2f3/Kickass/KickassHTML2MySQL/main.cpp
--------------------------------------------------------------------------------
/Kickass/KickassHTMLScan/KickassHTMLScan.cbp:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/Kickass/KickassHTMLScan/KickassHTMLScan.depend:
--------------------------------------------------------------------------------
1 | # depslib dependency file v1.0
2 | 1418554732 source:e:\documents\github\kickasscopy\kickasshtmlscan\main.cpp
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | 1418424267 source:c:\users\nico_000\documents\github\kickasscopy\kickasshtmlscan\main.cpp
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Kickass/KickassHTMLScan/KickassHTMLScan.layout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Kickass/KickassHTMLScan/Remove-Delete Duplicate Lines (to check if my programm works).url:
--------------------------------------------------------------------------------
1 | [InternetShortcut]
2 | URL=http://textmechanic.com/Remove-Duplicate-Lines.html
3 |
--------------------------------------------------------------------------------
/Kickass/KickassHTMLScan/main.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicoboss/KickassCopy/52fdff61c67d603d6f07912fcd8658f5fa1ec2f3/Kickass/KickassHTMLScan/main.cpp
--------------------------------------------------------------------------------
/Kickass/KickassHTMLScan/main_standartsuche.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicoboss/KickassCopy/52fdff61c67d603d6f07912fcd8658f5fa1ec2f3/Kickass/KickassHTMLScan/main_standartsuche.cpp
--------------------------------------------------------------------------------
/Kickass/KickassLinkCreator/KickassLinkCreator.cbp:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/Kickass/KickassLinkCreator/KickassLinkCreator.depend:
--------------------------------------------------------------------------------
1 | # depslib dependency file v1.0
2 | 1418768905 source:c:\users\nico_000\documents\github\kickasscopy\kickasslinkcreator\main.cpp
3 |
4 |
5 |
6 | "windows.h"
7 |
8 |
9 |
10 | 1418929818 source:e:\documents\github\kickasscopy\kickasslinkcreator\main.cpp
11 |
12 |
13 |
14 | "windows.h"
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Kickass/KickassLinkCreator/KickassLinkCreator.layout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Kickass/KickassLinkCreator/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include "windows.h"
5 | #include
6 | #include
7 |
8 | using namespace std;
9 |
10 | bool Read_MaxPagesFile(void);
11 | void brute5(void);
12 | bool next(string& x);
13 |
14 |
15 | vector MaxPages;
16 | vector MaxPages_Organisation;
17 | unsigned long MaxPages_length=0;
18 | bool MaxPages_out_of_range=false;
19 |
20 |
21 | //https://kickass.so/usearch/cds/
22 |
23 | int main()
24 | {
25 | Read_MaxPagesFile();
26 | //ShellExecute(0, "open", "curl", "https://kickass.so/", 0, SW_SHOWNORMAL);
27 | //ShellExecute(NULL, "open", "curl.exe", "https://kickass.so/the-good-lie-2014-720p-brrip-x264-yify-t9946721.html", NULL, SW_SHOWNORMAL);
28 | brute5();
29 |
30 | /*
31 | Bug Fixed!
32 | if(MaxPages_out_of_range==true and MaxPages_length>0)
33 | {
34 | cout << "Warning:\nThe length of MaxPages has exceeded and gave an an out_of_range error.\n"
35 | << "For the missing values was used the defult value of 20 pages. Are you sure,\n"
36 | << "that you have analyced every file? Maybe the order is also incorrect.\n"
37 | << "In this case it is beather to delete the MaxPages.txt\n"
38 | << "file and take for every value the defult value.\n"
39 | << "But the best thing is stil a working MaxPages.txt file." << endl;
40 | }
41 | */
42 |
43 | cout << "\nDone!" << endl;
44 | cout << "Press ENTER to close the program" << endl;
45 | cin.get();
46 | return 0;
47 | }
48 |
49 |
50 |
51 | bool Read_MaxPagesFile(void)
52 | {
53 | char line[8];
54 | string line_string;
55 | ifstream infile ("MaxPages.txt", ios::in);
56 | if (!infile)
57 | {
58 | MaxPages_length=0;
59 | cout << "Warning: MaxPages.txt does not exist!\nAre you sur that you had created one with MaxPagesScan and\ncopyed it into this programm Folder?\n" <<
60 | "For this progress the defult value of 20 pages will be tacken for every\ncombination, but you'll have a lot of dublications and missing Links!\n" << endl;
61 | return false;
62 | }
63 |
64 | while (infile.getline(line, 8))
65 | {
66 | line_string=line;
67 | //cout << line_string.substr(0,3) << endl;
68 | //cout << line_string.substr(4,line_string.length()-4) << endl;
69 | MaxPages_Organisation.push_back(line_string.substr(0,3));
70 | MaxPages.push_back(atoi(line_string.substr(4).c_str()));
71 | //cout << line << endl;
72 | }
73 | MaxPages_length=MaxPages.size();
74 | return true;
75 | }
76 |
77 |
78 | void brute5(void)
79 | {
80 | unsigned long Pos=0;
81 | int i_max;
82 | fstream fs;
83 | fs.open ("kickass_for_HTtrack.txt", fstream::out);
84 | string brute="http://kickass.so/usearch/000";//('a', 48);
85 | do {
86 | //ShellExecute(NULL, "open", "document.doc", NULL, NULL, SW_SHOWNORMAL);
87 | if(brute[brute.length()-1]<'a' or brute[brute.length()-2]<'a' or brute[brute.length()-3]<'a') //Nubers in conbination only mod
88 | {
89 | //cout << brute << endl; //endl is better because Buffer Overvlow but slower than << "\n"! The Best thinng is to don't show anything!
90 | //cout << MaxPages_Organisation.at(Pos) << endl;
91 | //cout << brute.substr(brute.length()-3) << endl;
92 | //cin.get();
93 | if(MaxPages_length>Pos and MaxPages_Organisation.at(Pos)==brute.substr(brute.length()-3))
94 | {
95 | i_max=MaxPages.at(Pos);
96 | //fs << brute << "/" << endl;
97 | for(int i=1; i<=i_max; i++)
98 | {
99 | if(i==1)
100 | {
101 | fs << brute << "/" << endl;
102 | cout << brute << "/" << endl;
103 | } else {
104 | fs << brute << "/" << i << "/" << endl;
105 | cout << brute << "/" << i << "/" << endl;
106 | }
107 | //fs << brute << "/" << endl;
108 |
109 | }
110 | Pos++;
111 | }
112 | //cout << "a";
113 | }
114 |
115 | if(brute=="http://kickass.so/usearch/zzz")
116 | {
117 | fs.close();
118 | return;
119 | }
120 |
121 | //if (hash(brute) == desired_hash)
122 | //return make_pair(true, brute);
123 | }
124 | while(next(brute));
125 | fs.close();
126 | return;
127 | }
128 |
129 |
130 | //http://www.cplusplus.com/forum/general/102786/
131 | bool next(string& x)
132 | {
133 | size_t len = x.size();
134 | bool overflow = true;
135 | while(overflow) {
136 | overflow = false;
137 | if(--len == 0)
138 | return false;
139 | (x[len] == 'z')?(overflow = true, x[len] = '0'):x[len] += 1;
140 | if(x[len]==':')
141 | x[len] += 39;
142 | }
143 | return true;
144 | }
145 |
--------------------------------------------------------------------------------
/Kickass/KickassMaxPagesScan/KickassMaxPagesScan.cbp:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/Kickass/KickassMaxPagesScan/KickassMaxPagesScan.depend:
--------------------------------------------------------------------------------
1 | # depslib dependency file v1.0
2 | 1418431696 source:c:\users\nico_000\documents\github\kickasscopy\maxpagesscan\main.cpp
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | 1418554780 source:e:\documents\github\kickasscopy\maxpagesscan\main.cpp
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Kickass/KickassMaxPagesScan/KickassMaxPagesScan.layout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Kickass/KickassMaxPagesScan/main.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicoboss/KickassCopy/52fdff61c67d603d6f07912fcd8658f5fa1ec2f3/Kickass/KickassMaxPagesScan/main.cpp
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Permission is hereby granted, free of charge, to any person obtaining a copy
2 | of this software and associated documentation files (the "Software"), to deal
3 | in the Software without restriction, including without limitation the rights
4 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5 | copies of the Software, and to permit persons to whom the Software is
6 | furnished to do so, subject to the following conditions:
7 |
8 | The above copyright notice and this permission notice shall be included in all
9 | copies or substantial portions of the Software.
10 |
11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17 | SOFTWARE.
--------------------------------------------------------------------------------
/Notes/Create_Kickass_V2_DB.txt:
--------------------------------------------------------------------------------
1 | SET
2 | spaltenname_neu = spaltenname_alt
3 |
4 | UPDATE kickass.open_bay SET description='' WHERE description IS NULL;
5 | UPDATE kickass.open_bay SET category_id=1 WHERE tags='anime';
6 | UPDATE kickass.open_bay SET category_id=2 WHERE tags='software';
7 | UPDATE kickass.open_bay SET category_id=3 WHERE tags='games';
8 | UPDATE kickass.open_bay SET category_id=4 WHERE tags='adult';
9 | UPDATE kickass.open_bay SET category_id=5 WHERE tags='movies';
10 | UPDATE kickass.open_bay SET category_id=7 WHERE tags='other';
11 | UPDATE kickass.open_bay SET category_id=6 WHERE tags='music';
12 | UPDATE kickass.open_bay SET category_id=8 WHERE tags='series & tv';
13 | UPDATE kickass.open_bay SET category_id=9 WHERE tags='books'
14 |
15 | UPDATE kickass.open_bay SET description='' WHERE description IS NULL;
16 | UPDATE kickass.open_bay SET category_id=1 WHERE tags='Anime';
17 | UPDATE kickass.open_bay SET category_id=2 WHERE tags='Application';
18 | UPDATE kickass.open_bay SET category_id=3 WHERE tags='Games';
19 | UPDATE kickass.open_bay SET category_id=4 WHERE tags='XXX';
20 | UPDATE kickass.open_bay SET category_id=5 WHERE tags='Movies';
21 | UPDATE kickass.open_bay SET category_id=7 WHERE tags='Other';
22 | UPDATE kickass.open_bay SET category_id=6 WHERE tags='Music';
23 | UPDATE kickass.open_bay SET category_id=8 WHERE tags='TV;
24 | UPDATE kickass.open_bay SET category_id=9 WHERE tags='Books'
25 |
26 | UPDATE kickass.open_bay SET description='' WHERE description IS NULL;
27 | UPDATE kickass.open_bay SET category_id=1 WHERE tags='Anime';
28 | UPDATE kickass.open_bay SET category_id=2 WHERE tags='Applications';
29 | UPDATE kickass.open_bay SET category_id=3 WHERE tags='Games';
30 | UPDATE kickass.open_bay SET category_id=4 WHERE tags='XXX';
31 | UPDATE kickass.open_bay SET category_id=5 WHERE tags='Movies';
32 | UPDATE kickass.open_bay SET category_id=7 WHERE tags='Other';
33 | UPDATE kickass.open_bay SET category_id=6 WHERE tags='Music';
34 | UPDATE kickass.open_bay SET category_id=8 WHERE tags='TV';
35 | UPDATE kickass.open_bay SET category_id=9 WHERE tags='Books';
36 |
37 |
38 | TV: 1004769 Datensätze betroffen. (Die Abfrage dauerte 198.1731 Sekunden.)
39 | Books: 359996 Datensätze betroffen. (Die Abfrage dauerte 173.3422 Sekunden.)
40 |
41 | select * from table where name like 'A%'
42 |
43 | UPDATE db.dailydump SET description='' WHERE description IS NULL;
44 |
45 | UPDATE db. dailydump SET category_id=1 WHERE tags like 'Anime%';
46 | Images?!?
47 | UPDATE db.dailydump SET category_id=2 WHERE tags like 'Applications%';
48 | UPDATE db. SET category_id=3 WHERE tags like 'Games%' or tags like 'Mobile%';
49 | UPDATE db.dailydump SET category_id=4 WHERE tags like 'Adult%';
50 | UPDATE db.dailydump SET category_id=5 WHERE tags like 'Video%';
51 | UPDATE db.dailydump SET category_id=7 WHERE tags='';
52 | UPDATE db.dailydump SET category_id=6 WHERE tags like 'Audio%';
53 | UPDATE db.dailydump SET category_id=9 WHERE tags like 'Ebooks%';
54 | UPDATE db.dailydump SET category_id=8 WHERE tags='Video Tv';
55 | UPDATE db.dailydump SET category_id=7 WHERE tags like 'Images%';
56 |
57 | UPDATE db.dailydump SET size=0 WHERE size IS NULL;
58 | UPDATE db.dailydump SET torrent_status=0 WHERE torrent_status IS NULL;
59 | UPDATE db.dailydump SET visible_status=0 WHERE visible_status IS NULL;
60 | UPDATE db.dailydump SET files_count=0 WHERE files_count IS NULL;
61 |
62 |
63 | INSERT INTO db.tp (name, hash, tags) SELECT name, hash, tags FROM torrentproject.dailydump
64 | UPDATE db.tp SET description='' WHERE description IS NULL
65 | UPDATE db.tp SET category_id=2 WHERE tags like 'Applications%';
66 | UPDATE db.tp SET category_id=3 WHERE tags like 'Games%' or tags like 'Mobile%';
67 | UPDATE db.tp SET category_id=4 WHERE tags like 'Adult%';
68 | UPDATE db.tp SET category_id=5 WHERE tags like 'Video%';
69 | UPDATE db.tp SET category_id=6 WHERE tags like 'Audio%';
70 | UPDATE db.tp SET category_id=7 WHERE tags like 'Images%';
71 | UPDATE db.tp SET category_id=7 WHERE tags='';
72 | UPDATE db.tp SET category_id=8 WHERE tags='Video Tv';
73 | UPDATE db.tp SET category_id=9 WHERE tags like 'Ebooks%';
74 |
75 |
--------------------------------------------------------------------------------
/Notes/How_to_import.txt:
--------------------------------------------------------------------------------
1 | How to import this DB:
2 | 1. Download and extract the DB
3 | 2. Import the 2 sql Files with LOAD DATA INFILE or with a graphical Interface like PHPMyAdmin.
4 | How to update this DB in 2 Steps:
5 | 1. Download and extract or clone https://github.com/nicoboss/KickassCopy and go into the UpdateTorrentProject folder and open the update.bat (Windows x64 only) file and wait some minutes. You can also use the UpdateTorrentProject in the Torrent file but it might be outdated but it would also work.
6 | 2. Copy the dailydump.csv to your /mysql/data/…/ folder and customize and execute the following SQL script. The scheme for the torrentproject.dailydump can you find also in the torrent file and the db.torrent is your final DB.
7 | LOAD DATA INFILE 'dailydump.csv' INTO TABLE torrentproject.dailydump_V3 FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n';
8 | INSERT IGNORE INTO db.torrent (name, hash, tags) SELECT name, hash, tags FROM torrentproject.dailydump;
9 | TRUNCATE TABLE torrentproject.dailydump;
10 | UPDATE db.torrent SET description='' WHERE description is NULL;
11 | UPDATE db.torrent SET category_id=2 WHERE tags like 'Applications%';
12 | UPDATE db.torrent SET category_id=3 WHERE tags like 'Games%' or tags like 'Mobile%';
13 | UPDATE db.torrent SET category_id=4 WHERE tags like 'Adult%';
14 | UPDATE db.torrent SET category_id=5 WHERE tags like 'Video%';
15 | UPDATE db.torrent SET category_id=6 WHERE tags like 'Audio%';
16 | UPDATE db.torrent SET category_id=7 WHERE tags like 'Images%';
17 | UPDATE db.torrent SET category_id=7 WHERE tags='';
18 | UPDATE db.torrent SET category_id=8 WHERE tags='Video Tv';
19 | UPDATE db.torrent SET category_id=9 WHERE tags like 'Ebooks%';
20 |
--------------------------------------------------------------------------------
/Notes/Notes.txt:
--------------------------------------------------------------------------------
1 | ALTER IGNORE TABLE one.all ADD UNIQUE INDEX hash
2 | ALTER IGNORE TABLE one.torrents
3 | ADD UNIQUE (`hash`);
4 | udp://tracker.openbittorrent.com:80/announce
5 | udp://tracker.publicbt.com:80/announce
6 | udp://tracker.ccc.de:80/announce
7 | udp://open.demonii.com:1337/announce
8 | udp://tracker.publicbt.com:80/announce
9 | udp://tracker.istole.it:80/announce
10 |
11 |
12 | ALTER TABLE torrents DROP INDEX description;
13 | ALTER IGNORE TABLE all ADD UNIQUE INDEX hash
14 | ALTER IGNORE TABLE `my_table`
15 | ADD UNIQUE (`hash`);
16 | ALTER IGNORE TABLE `all`
17 | ADD UNIQUE (`hash`);
18 |
19 |
20 | insert ignore INTO all_in_one SELECT * FROM full_torrents
21 | LOAD DATA INFILE 'All_in_one_finish.csv' INTO TABLE db.all FIELDS TERMINATED BY ',' ENCLOSED BY '"'
22 |
23 |
24 | LOAD DATA INFILE 'BitSnoop_dump_26-FEB-14.csv' INTO TABLE bitsnoop.26_feb_2014 FIELDS TERMINATED BY '|' LINES TERMINATED BY '\n' (hash,name)
25 | UPDATE bitsnoop.26_feb_2014 SET description='' WHERE description IS NULL;
26 | UPDATE bitsnoop.26_feb_2014 SET tags='' WHERE tags IS NULL;
27 |
28 |
29 | LOAD DATA INFILE 'All_in_one_finish.csv' IGNORE INTO TABLE All_in_one_finish.torrents FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '"'
30 | LOAD DATA INFILE 'opb.csv' IGNORE INTO TABLE db.torrents FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '"'
31 | LOAD DATA INFILE 'dailydump.txt' IGNORE INTO TABLE torrentproject.dailydump FIELDS TERMINATED BY '|' LINES TERMINATED BY '\n'
32 | LOAD DATA INFILE 'dailydump.csv' INTO TABLE torrentproject.dailydump_V3 FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n'
33 |
34 |
35 |
--------------------------------------------------------------------------------
/PirateBay/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | using namespace std;
9 |
10 |
11 | //Global Variables have to be Glabal!
12 | unsigned long magnet_count=0;
13 | unsigned long magnet_count_temp=0;
14 | unsigned long magnet_clock;
15 | unsigned int magnet_duplication_cont=0;
16 | unsigned int magnet_duplication_cont_temp=0;
17 |
18 |
19 | void Get_all_Files(string dir, unsigned int pack);
20 |
21 | int main()
22 | {
23 | mkdir("./Magnet");
24 | stringstream parm_ss;
25 | string parm;
26 | stringstream filename;
27 | ofstream outfile; //("IsoHunt.txt", ios::out|ios::binary|ios::trunc);
28 | for(int pack=0;pack<120;pack++)
29 | {
30 | cout << pack << endl;
31 | filename.str("");
32 | filename.clear();
33 | filename << "thepiratebay_Part" << pack << ".txt";
34 | outfile.open(filename.str(), ios::out|ios::binary|ios::trunc);
35 | for(int i=pack*99999;i
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 |
--------------------------------------------------------------------------------
/PirateBay/oldpiratebayCopy.depend:
--------------------------------------------------------------------------------
1 | # depslib dependency file v1.0
2 | 1418758148 source:e:\documents\github\kickasscopy\oldpiratebaycopy\main.cpp
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/PirateBay/oldpiratebayCopy.layout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | KickassCopy
2 | ===========
3 |
4 | KickassCopy is a collection of tools (often written in C++) to dump torrent pages into an SQL database.
5 | I started this project 2 days after the December 2014 Raid against PirateBaybefore I even heard of the openbay project.
6 |
7 | ## Fautures
8 | * Getting live Database updates by using RSS feeds from famous Torrent sites.
9 | * Creating Download lists for HTTrack
10 | * Brut force search downloading (uses much CPU on the Sphinx Server if you are not careful with this you could DOS the site you are trying to download or will be banned)
11 | * Reading the maximal amount of Search results from the first page of every bruteforce result and make a list with every existing site for HTTrack.
12 | * Convert the downloaded HTML files into an importable, with MySQL compatible, CSV file or in a magnet/torcache URL-list
13 | * Duplicate filter to remove equal torrent search result (ca. 50% if you use brute force)
14 | * Converter from dalydumps (Torrent api) into importable CSV files.
15 | * A lot of useful tools to convert, split and edit raw data, csv files and HTTrack download list. I recommend not downloading more than 999999 in one step because if you do you have to remove the HTTrack max links limit in the settings and also the ban possibility is higher if you download that much in one step. Try to always to get the best download speed by using more connections and a high download rate but try not to slowdown the server.
16 | * Notes with useful MySQL commands and import instructions.
17 |
18 | ## What you need to build:
19 | - A windows PC – Other operating systems will need slight code modifications
20 | - A C++ Compiler like MinGW
21 | - An IDE - I'm using Code::Blocks
22 |
23 | ## How to build:
24 | Just open the main .cpp file of the subproject in your favorite IDE. I don't use any headers or libraries to make this step as easy as possible. If you use Code::Blocks as your IDE you can just open the Code::Blocks project and it should be ready to build.
25 |
--------------------------------------------------------------------------------
/Tools/AddTerminated2api/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | using namespace std;
12 |
13 | int main()
14 | {
15 | string line;
16 | int Pos1=string::npos;
17 | int Pos2=string::npos;
18 | int Pos3=string::npos;;
19 | int Pos4=string::npos;;
20 | int i=1;
21 |
22 | ofstream outfile("dailydump.csv", ios::out|ios::trunc|ios::binary);
23 | ifstream infile("dailydump.txt", ios::in|ios::binary);
24 | while(getline(infile, line))
25 | {
26 | //cout << line << endl;
27 | Pos1=line.find_first_of('|');
28 | Pos4=line.find_last_of('|');
29 | Pos3=line.find_last_of('|', Pos4-1);
30 | Pos2=line.find_last_of('|', Pos3-1);
31 |
32 | //cout << Pos1 << " " << Pos2 << " " << Pos3 << " " << Pos4 << endl;
33 |
34 | //cout << line.substr(0,Pos1+1) << '"' << line.substr(Pos1+1,Pos2-Pos1-1) << '"' << line.substr(Pos2) << endl;
35 |
36 | if(Pos1!=string::npos and Pos2!=string::npos and Pos3!=string::npos and Pos4!=string::npos)
37 | {
38 | outfile << i << '|' << line.substr(0,Pos1+1) << '"' << line.substr(Pos1+1,Pos2-Pos1-1) << '"' << line.substr(Pos2) << endl;
39 | } else {
40 | //cout << "Error: " << line.substr(0,Pos1+1) << '"' << line.substr(Pos1+1,Pos2-Pos1-1) << '"' << line.substr(Pos2) << '\n' << endl;
41 | cout << "Error: " << line << '\n' << endl;
42 | }
43 |
44 | i++;
45 |
46 | //system("pause");
47 |
48 | //outfileline
49 | }
50 | infile.close();
51 | outfile.close();
52 | }
53 |
--------------------------------------------------------------------------------
/Tools/DB_RSS-Feed updater.rar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicoboss/KickassCopy/52fdff61c67d603d6f07912fcd8658f5fa1ec2f3/Tools/DB_RSS-Feed updater.rar
--------------------------------------------------------------------------------
/Tools/Magnet2Torrent C++/Bencode.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2012, BitTorrent Inc.
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 |
10 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11 | */
12 |
13 | #include "Bencode.h"
14 |
15 | #include
16 | #include
17 |
18 | BencodeObject::BencodeObject() {
19 | _type = BencodeTypeInvalid;
20 | _mem = NULL;
21 | _listValue = NULL;
22 | _dictValue = NULL;
23 | _stringValue = NULL;
24 | _serializedSize = 0;
25 |
26 | _mode = BencodeModeNondestructive;
27 | }
28 |
29 | BencodeObject::BencodeObject(const BencodeType type) {
30 | _type = type;
31 | _mem = NULL;
32 | _listValue = NULL;
33 | _dictValue = NULL;
34 | _stringValue = NULL;
35 | _serializedSize = 0;
36 |
37 | _mode = BencodeModeDestructive;
38 |
39 | switch (type) {
40 | case BencodeTypeInteger:
41 | _intValue = 0;
42 | break;
43 | case BencodeTypeByteString:
44 | _byteStringPtr = NULL;
45 | _byteStringSize = 0;
46 | break;
47 | case BencodeTypeList:
48 | _listValue = new BencodeListStorage();
49 | break;
50 | case BencodeTypeDictionary:
51 | _dictValue = new BencodeDictStorage();
52 | break;
53 | default:
54 | break;
55 | }
56 | }
57 |
58 | BencodeObject::BencodeObject(const char* string, BencodeMode mode) {
59 | _type = BencodeTypeByteString;
60 | _mem = NULL;
61 | _listValue = NULL;
62 | _dictValue = NULL;
63 | _stringValue = NULL;
64 | _serializedSize = 0;
65 |
66 | _byteStringPtr = (void*)string;
67 | _byteStringSize = strlen(string);
68 |
69 | if (mode == BencodeModeCopy) {
70 | _mem = malloc(_byteStringSize);
71 | memcpy(_mem, _byteStringPtr, _byteStringSize);
72 | _mode = BencodeModeDestructive;
73 | _byteStringPtr = _mem;
74 | } else if (mode == BencodeModeAdopt) {
75 | _mem = _byteStringPtr;
76 | _mode = BencodeModeDestructive;
77 | } else {
78 | _mode = mode;
79 | }
80 | }
81 |
82 | BencodeObject::BencodeObject(const void* data, size_t len, BencodeMode mode) {
83 | _type = BencodeTypeInvalid;
84 | _mem = NULL;
85 | _listValue = NULL;
86 | _dictValue = NULL;
87 | _stringValue = NULL;
88 | _serializedSize = 0;
89 |
90 | char* origin = (char*)data;
91 | char* ptr = (char*)data;
92 |
93 | // this takes a bit more memory than needed but tends to perform better than
94 | // just allocating memory for every byte string
95 | if (mode == BencodeModeCopy) {
96 | _mem = malloc(len);
97 | memcpy(_mem, data, len);
98 | _mode = BencodeModeDestructive;
99 | origin = ptr = (char*)_mem;
100 | } else if (mode == BencodeModeAdopt) {
101 | _mem = (void*)data;
102 | _mode = BencodeModeDestructive;
103 | } else {
104 | _mode = mode;
105 | }
106 |
107 | size_t rem = len;
108 |
109 | if (*ptr == 'i' || (*ptr >= '0' && *ptr <= '9')) {
110 | // integer or byte string
111 | int64_t number = 0;
112 | bool negate = false;
113 | bool isInteger = (*ptr == 'i');
114 | if (isInteger) {
115 | ++ptr;
116 | --rem;
117 | }
118 | if (rem > 0 && *ptr == '-') {
119 | negate = true;
120 | ++ptr;
121 | --rem;
122 | }
123 | while (rem > 0) {
124 | if (*ptr >= '0' && *ptr <= '9') {
125 | number = number * 10 + (*ptr - '0');
126 | ++ptr;
127 | --rem;
128 | } else {
129 | break;
130 | }
131 | }
132 | if (rem > 0) {
133 | if (isInteger) {
134 | if (*ptr == 'e') {
135 | // int read successfully
136 | _type = BencodeTypeInteger;
137 | _intValue = (negate ? -number : number);
138 | ++ptr;
139 | --rem;
140 | } else {
141 | printf("Invalid integer.\n");
142 | return;
143 | }
144 | } else if (!negate && *ptr == ':' && rem > number) {
145 | // byte string read successfully
146 | ++ptr;
147 | --rem;
148 | _type = BencodeTypeByteString;
149 | _byteStringPtr = ptr;
150 | _byteStringSize = number;
151 | ptr += number;
152 | rem -= number;
153 | } else {
154 | printf("Invalid byte string length.\n");
155 | return;
156 | }
157 | }
158 | } else if (*ptr == 'd') {
159 | // dictionary
160 | ++ptr;
161 | --rem;
162 | _dictValue = new BencodeDictStorage();
163 | BencodeDictStorage::iterator lastIt = _dictValue->begin();
164 | while (rem > 0) {
165 | if (*ptr == 'e') {
166 | // read successfully
167 | _type = BencodeTypeDictionary;
168 | ++ptr;
169 | --rem;
170 | break;
171 | }
172 | BencodeObject key(ptr, rem, _mode);
173 | if (key.type() != BencodeTypeByteString || key._actualLength == 0) {
174 | printf("Invalid dict key.\n");
175 | return;
176 | }
177 | if (lastIt != _dictValue->end() && key <= lastIt->first) {
178 | printf("Dict key out of order.\n");
179 | return;
180 | }
181 | ptr += key._actualLength;
182 | rem -= key._actualLength;
183 | BencodeObject val(ptr, rem, _mode);
184 | if (val.type() == BencodeTypeInvalid) {
185 | printf("Invalid dict value.\n");
186 | return;
187 | }
188 | ptr += val._actualLength;
189 | rem -= val._actualLength;
190 | lastIt = _dictValue->insert(lastIt, BencodeDictStorage::value_type(key, val));
191 | }
192 | } else if (*ptr == 'l') {
193 | // list
194 | ++ptr;
195 | --rem;
196 | _listValue = new BencodeListStorage();
197 | while (rem > 0) {
198 | if (*ptr == 'e') {
199 | // read successfully
200 | _type = BencodeTypeList;
201 | ++ptr;
202 | --rem;
203 | break;
204 | }
205 | BencodeObject element(ptr, rem, _mode);
206 | if (element.type() == BencodeTypeInvalid || element._actualLength == 0) {
207 | printf("Invalid list element.\n");
208 | return;
209 | }
210 | ptr += element._actualLength;
211 | rem -= element._actualLength;
212 | _listValue->push_back(element);
213 | }
214 | }
215 |
216 | _actualLength = len - rem;
217 | }
218 |
219 | BencodeObject::BencodeObject(const BencodeObject& obj) {
220 | _mem = NULL;
221 | _listValue = NULL;
222 | _dictValue = NULL;
223 | _stringValue = NULL;
224 |
225 | *this = obj;
226 | }
227 |
228 | BencodeObject& BencodeObject::operator=(const BencodeObject &obj) {
229 | free(_mem);
230 | delete _listValue;
231 | delete _dictValue;
232 | free(_stringValue);
233 |
234 | memcpy(this, &obj, sizeof(*this));
235 |
236 | const_cast(&obj)->_mem = NULL;
237 | const_cast(&obj)->_dictValue = NULL;
238 | const_cast(&obj)->_listValue = NULL;
239 | const_cast(&obj)->_stringValue = NULL;
240 | const_cast(&obj)->_serializedSize = 0;
241 | const_cast(&obj)->_type = BencodeTypeInvalid;
242 |
243 | return *this;
244 | }
245 |
246 | BencodeObject::~BencodeObject() {
247 | free(_mem);
248 | delete _listValue;
249 | delete _dictValue;
250 | free(_stringValue);
251 | }
252 |
253 | void BencodeObject::setIntValue(int64_t val) {
254 | if (_type != BencodeTypeInteger) {
255 | return;
256 | }
257 |
258 | _intValue = val;
259 | _serializedSize = 0;
260 | }
261 |
262 | void BencodeObject::setByteStringValue(const void* val, size_t len, BencodeMode mode) {
263 | if (_type != BencodeTypeByteString) {
264 | return;
265 | }
266 |
267 | free(_mem);
268 | _mem = NULL;
269 |
270 | free(_stringValue);
271 | _stringValue = NULL;
272 |
273 | if (mode == BencodeModeCopy) {
274 | _mem = malloc(len);
275 | memcpy(_mem, val, len);
276 | _mode = BencodeModeDestructive;
277 | _byteStringPtr = _mem;
278 | } else if (mode == BencodeModeAdopt) {
279 | _mem = (void*)val;
280 | _mode = BencodeModeDestructive;
281 | _byteStringPtr = _mem;
282 | } else {
283 | _mode = mode;
284 | _byteStringPtr = (void*)val;
285 | }
286 |
287 | _byteStringSize = len;
288 | }
289 |
290 | BencodeObject* BencodeObject::setValueForKey(const char* key, BencodeObject* val) {
291 | if (_type != BencodeTypeDictionary) {
292 | return NULL;
293 | }
294 |
295 | removeValueForKey(key);
296 |
297 | BencodeObject kobj(key, BencodeModeCopy);
298 | return const_cast(&_dictValue->insert(BencodeDictStorage::value_type(kobj, *val)).first->second);
299 | }
300 |
301 | void BencodeObject::removeValueForKey(const char* key) {
302 | BencodeObject kobj(key, BencodeModeCopy);
303 | _dictValue->erase(kobj);
304 | }
305 |
306 | bool BencodeObject::operator> (const BencodeObject &obj) const {
307 | if (_type != obj._type) {
308 | return (_type > obj._type);
309 | }
310 |
311 | switch (_type) {
312 | case BencodeTypeInteger:
313 | return (_intValue > obj._intValue);
314 | case BencodeTypeList:
315 | return (_listValue->size() > obj._listValue->size());
316 | case BencodeTypeDictionary:
317 | return (_dictValue->size() > obj._dictValue->size());
318 | break;
319 | case BencodeTypeByteString: {
320 | size_t minSize = (_byteStringSize < obj._byteStringSize ? _byteStringSize : obj._byteStringSize);
321 | int cmp = memcmp(_byteStringPtr, obj._byteStringPtr, minSize);
322 | if (cmp > 0) {
323 | return true;
324 | } else if (cmp == 0) {
325 | return (_byteStringSize > obj._byteStringSize);
326 | } else {
327 | return false;
328 | }
329 | }
330 | default:
331 | return false;
332 | }
333 | }
334 |
335 | bool BencodeObject::operator< (const BencodeObject &obj) const {
336 | return (obj > *this);
337 | }
338 |
339 | bool BencodeObject::operator>= (const BencodeObject &obj) const {
340 | return !(obj > *this);
341 | }
342 |
343 | bool BencodeObject::operator<= (const BencodeObject &obj) const {
344 | return !(*this > obj);
345 | }
346 |
347 | BencodeType BencodeObject::type() {
348 | return _type;
349 | }
350 |
351 | int64_t BencodeObject::intValue(int64_t def) {
352 | return (_type == BencodeTypeInteger ? _intValue : def);
353 | }
354 |
355 | BencodeObject* BencodeObject::valueForKey(const char* key) {
356 | if (_type != BencodeTypeDictionary) {
357 | return NULL;
358 | }
359 |
360 | BencodeObject keyObject(key, BencodeModeNondestructive);
361 |
362 | BencodeDictStorage::iterator it = _dictValue->find(keyObject);
363 | if (it == _dictValue->end()) {
364 | return NULL;
365 | }
366 |
367 | return &it->second;
368 | }
369 |
370 | int64_t BencodeObject::intValueForKey(const char* key, int64_t def) {
371 | BencodeObject* obj = valueForKey(key);
372 |
373 | return (obj ? obj->intValue(def) : def);
374 | }
375 |
376 | const char* BencodeObject::stringValueForKey(const char* key, const char* def) {
377 | BencodeObject* obj = valueForKey(key);
378 |
379 | return (obj ? obj->_terminatedStringValue(def, _mode != BencodeModeNondestructive) : def);
380 | }
381 |
382 | const void* BencodeObject::byteStringValueForKey(const char* key, size_t* len) {
383 | BencodeObject* obj = valueForKey(key);
384 |
385 | return (obj ? obj->byteStringValue(len) : NULL);
386 | }
387 |
388 | BencodeDictStorage* BencodeObject::dictValue() {
389 | return _dictValue;
390 | }
391 |
392 | unsigned int BencodeObject::count() {
393 | return (_type == BencodeTypeDictionary ? _dictValue->size() : (_type == BencodeTypeList ? _listValue->size() : 0));
394 | }
395 |
396 | BencodeObject* BencodeObject::valueAtIndex(unsigned int i) {
397 | return (_type == BencodeTypeList && i < count() ? &(*_listValue)[i] : NULL);
398 | }
399 |
400 | BencodeListStorage* BencodeObject::listValue() {
401 | return _listValue;
402 | }
403 |
404 | const void* BencodeObject::byteStringValue(size_t* len) {
405 | if (_type != BencodeTypeByteString) {
406 | return NULL;
407 | }
408 |
409 | if (len) {
410 | *len = _byteStringSize;
411 | }
412 |
413 | return _byteStringPtr;
414 | }
415 |
416 | const char* BencodeObject::stringValue(const char* def) {
417 | if (_type != BencodeTypeByteString) {
418 | return NULL;
419 | }
420 |
421 | return _terminatedStringValue(def, false);
422 | }
423 |
424 | const char* BencodeObject::_terminatedStringValue(const char* def, bool terminateInPlace) {
425 | if (_type != BencodeTypeByteString) {
426 | return def;
427 | }
428 |
429 | if (_stringValue) {
430 | return _stringValue;
431 | }
432 |
433 | if (terminateInPlace) {
434 | ((char*)_byteStringPtr)[_byteStringSize] = '\0';
435 | return (char*)_byteStringPtr;
436 | }
437 |
438 | _stringValue = (char*)malloc(_byteStringSize + 1);
439 | memcpy(_stringValue, _byteStringPtr, _byteStringSize + 1);
440 | _stringValue[_byteStringSize] = '\0';
441 |
442 | return _stringValue;
443 | }
444 |
445 | size_t BencodeObject::serializedSize() {
446 | if (_serializedSize != 0) {
447 | return _serializedSize;
448 | }
449 |
450 | switch (_type) {
451 | case BencodeTypeInteger:
452 | case BencodeTypeByteString: {
453 | int64_t n = (_type == BencodeTypeInteger ? _intValue : _byteStringSize);
454 | if (n == 0) {
455 | ++_serializedSize;
456 | } else {
457 | if (n < 0) {
458 | ++_serializedSize;
459 | n *= -1;
460 | }
461 | while (n > 0) {
462 | ++_serializedSize;
463 | n /= 10;
464 | }
465 | }
466 | if (_type == BencodeTypeInteger) {
467 | _serializedSize += 2; // for i and e
468 | } else {
469 | ++_serializedSize; // for colon
470 | _serializedSize += _byteStringSize;
471 | }
472 | break;
473 | }
474 | case BencodeTypeDictionary: {
475 | for (BencodeDictStorage::iterator it = _dictValue->begin(); it != _dictValue->end(); ++it) {
476 | _serializedSize += ((BencodeObject*)&it->first)->serializedSize();
477 | _serializedSize += ((BencodeObject*)&it->second)->serializedSize();
478 | }
479 | _serializedSize += 2; // for d and e
480 | break;
481 | }
482 | case BencodeTypeList: {
483 | for (BencodeListStorage::iterator it = _listValue->begin(); it != _listValue->end(); ++it) {
484 | _serializedSize += ((BencodeObject&)*it).serializedSize();
485 | }
486 | _serializedSize += 2; // for l and e
487 | break;
488 | }
489 | default:
490 | break;
491 | }
492 |
493 | return _serializedSize;
494 | }
495 |
496 | size_t BencodeObject::serialize(void* dest, size_t maxlen) {
497 | size_t req = serializedSize();
498 |
499 | if (maxlen < req) {
500 | return 0;
501 | }
502 |
503 | char* ptr = (char*)dest;
504 |
505 | switch (_type) {
506 | case BencodeTypeInteger:
507 | case BencodeTypeByteString: {
508 | char* p = ptr;
509 | int64_t n;
510 | if (_type == BencodeTypeInteger) {
511 | *(ptr++) = 'i';
512 | n = _intValue;
513 | } else {
514 | n = _byteStringSize;
515 | }
516 | if (n == 0) {
517 | *(ptr++) = '0';
518 | } else {
519 | if (n < 0) {
520 | *(ptr++) = '-';
521 | n *= -1;
522 | }
523 | int64_t m = 1000000000000000000LL;
524 | while (n < m) {
525 | m /= 10;
526 | }
527 | while (m > 0) {
528 | *(ptr++) = ('0' + (n / m));
529 | n %= m;
530 | m /= 10;
531 | }
532 | }
533 | if (_type == BencodeTypeInteger) {
534 | *(ptr++) = 'e';
535 | } else {
536 | *(ptr++) = ':';
537 | memcpy(ptr, _byteStringPtr, _byteStringSize);
538 | ptr += _byteStringSize;
539 | }
540 | break;
541 | }
542 | case BencodeTypeDictionary: {
543 | *(ptr++) = 'd';
544 | for (BencodeDictStorage::iterator it = _dictValue->begin(); it != _dictValue->end(); ++it) {
545 | // maxlen is passed because we've already ensured that the destination is large enough for everything
546 | ptr += ((BencodeObject*)&it->first)->serialize(ptr, maxlen);
547 | ptr += ((BencodeObject*)&it->second)->serialize(ptr, maxlen);
548 | }
549 | *(ptr++) = 'e';
550 | break;
551 | }
552 | case BencodeTypeList: {
553 | *(ptr++) = 'l';
554 | for (BencodeListStorage::iterator it = _listValue->begin(); it != _listValue->end(); ++it) {
555 | // maxlen is passed because we've already ensured that the destination is large enough for everything
556 | ptr += ((BencodeObject&)*it).serialize(ptr, maxlen);
557 | }
558 | *(ptr++) = 'e';
559 | break;
560 | }
561 | default:
562 | break;
563 | }
564 |
565 | return req;
566 | }
567 |
--------------------------------------------------------------------------------
/Tools/Magnet2Torrent C++/Bencode.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2012, BitTorrent Inc.
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 |
10 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11 | */
12 |
13 | #ifndef BENCODE_H
14 | #define BENCODE_H
15 |
16 | #include