├── .gitignore
├── LICENSE
├── README.md
├── assets
├── names.txt
└── photos
│ └── picture.jpg
├── functions
├── 2fa.py
├── archive
│ └── voice_chat.py
├── base
│ ├── __init__.py
│ ├── base.py
│ ├── pyrogram.py
│ └── telethon.py
├── change_profile_photo.py
├── changebio.py
├── changename.py
├── clear_chats.py
├── flood.py
├── flood_chat.py
├── flood_comments.py
├── flood_without_trigger.py
├── inviting.py
├── joiner.py
├── kick_all_sessions.py
├── pmflood.py
├── poll_vote.py
├── reactions.py
├── report.py
├── report_user.py
├── spamblock.py
└── statistics_phones.py
├── main.py
├── media
└── picture.jpg
├── modules
├── generators
│ ├── application.py
│ ├── linux.py
│ └── telegram_android.py
├── settings.py
├── storages
│ ├── functions_storage.py
│ └── sessions_storage.py
├── types
│ ├── account.py
│ ├── account_settings.py
│ ├── application.py
│ ├── json_session.py
│ └── proxy.py
└── updater.py
├── requirements.txt
└── sessions
├── add_session.py
└── login.py
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | pip-wheel-metadata/
24 | share/python-wheels/
25 | *.egg-info/
26 | .installed.cfg
27 | *.egg
28 | MANIFEST
29 |
30 | # PyInstaller
31 | # Usually these files are written by a python script from a template
32 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
33 | *.manifest
34 | *.spec
35 |
36 | # Installer logs
37 | pip-log.txt
38 | pip-delete-this-directory.txt
39 |
40 | # Unit test / coverage reports
41 | htmlcov/
42 | .tox/
43 | .nox/
44 | .coverage
45 | .coverage.*
46 | .cache
47 | nosetests.xml
48 | coverage.xml
49 | *.cover
50 | *.py,cover
51 | .hypothesis/
52 | .pytest_cache/
53 |
54 | # Translations
55 | *.mo
56 | *.pot
57 |
58 | # Django stuff:
59 | *.log
60 | local_settings.py
61 | db.sqlite3
62 | db.sqlite3-journal
63 |
64 | # Flask stuff:
65 | instance/
66 | .webassets-cache
67 |
68 | # Scrapy stuff:
69 | .scrapy
70 |
71 | # Sphinx documentation
72 | docs/_build/
73 |
74 | # PyBuilder
75 | target/
76 |
77 | # Jupyter Notebook
78 | .ipynb_checkpoints
79 |
80 | # IPython
81 | profile_default/
82 | ipython_config.py
83 |
84 | # pyenv
85 | .python-version
86 |
87 | # pipenv
88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
91 | # install all needed dependencies.
92 | #Pipfile.lock
93 |
94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95 | __pypackages__/
96 |
97 | # Celery stuff
98 | celerybeat-schedule
99 | celerybeat.pid
100 |
101 | # SageMath parsed files
102 | *.sage.py
103 |
104 | # Environments
105 | .env
106 | .venv
107 | env/
108 | venv/
109 | ENV/
110 | env.bak/
111 | venv.bak/
112 |
113 | # Spyder project settings
114 | .spyderproject
115 | .spyproject
116 |
117 | # Rope project settings
118 | .ropeproject
119 |
120 | # mkdocs documentation
121 | /site
122 |
123 | # mypy
124 | .mypy_cache/
125 | .dmypy.json
126 | dmypy.json
127 |
128 | *.session
129 | config.toml
130 | # Pyre type checker
131 | .pyre/
132 | *.jsession
133 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Ботнет для рейд атак в Telegram
2 | Инструкция по установке: https://teletype.in/@lkqas/telegram-raid-botnet
3 |
4 | Разработчик: [@json1c](https://t.me/json1c)
5 |
6 | # Проект больше не обновляется
7 | К сожалению, из-за отсутствия интереса я больше не хочу обновлять этот проект.
8 |
9 | Осуществляю только поддержку работы ботнета и подстраиваю под обновления библиотек.
10 |
11 | Из нового функционала - делаю только приватные функции. Если хотите купить или заказать разработку какой-то определенной функции, которой еще нет - пишите [@json1c](https://t.me/json1c)
12 |
--------------------------------------------------------------------------------
/assets/names.txt:
--------------------------------------------------------------------------------
1 | انا لست عربيا
2 | انا لست ع
3 | من أنت
4 | عربي لا
5 | عر
6 | مرحبا يار
7 | مرحب
8 | مرحبا يا ر
9 | م
10 | مرحايا رج
11 | Vihaan
12 | Gurkiran
13 | Madhup Shukla
14 | Harikiran Chatterdzhi
15 | Himmat Mikhopadhyay
16 | Yakshit Vamankar
17 | Yakshit Valli
18 | Yashvi Abusariya
19 | Shukla Chaturvedi
20 | Chaturvedi Yakshit
21 | Rachapalli Madhup
22 |
--------------------------------------------------------------------------------
/assets/photos/picture.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/json1c/telegram-raid-botnet/a82845a5c78351a66aef24804a284656ed25d2b6/assets/photos/picture.jpg
--------------------------------------------------------------------------------
/functions/2fa.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 | import asyncio
15 |
16 | from rich.console import Console
17 | from rich.markup import escape
18 |
19 | from telethon import TelegramClient
20 | from functions.base import TelethonFunction
21 |
22 | console = Console()
23 |
24 | class SetPasswordFunc(TelethonFunction):
25 | """Set two-step verification password to accounts"""
26 |
27 | async def edit_2fa(self, session: TelegramClient, password: str):
28 | async with self.storage.ainitialize_session(session):
29 | me = await session.get_me()
30 |
31 | try:
32 | await session.edit_2fa(new_password=password)
33 | except Exception as err:
34 | console.print(
35 | "[{name}] : [bold red]Password not changed[/]. Error: {error}"
36 | .format(name=escape(me.first_name), error=err)
37 | )
38 | else:
39 | console.print(
40 | "[{name}] : [bold green]Successfully updated password"
41 | .format(name=escape(me.first_name))
42 | )
43 |
44 | async def execute(self):
45 | password = console.input("[bold red]new password> [/]")
46 |
47 | with console.status("Setting password..."):
48 | await asyncio.wait([
49 | self.edit_2fa(session=session, password=password)
50 | for session in self.sessions
51 | ])
52 |
53 |
--------------------------------------------------------------------------------
/functions/archive/voice_chat.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 | import asyncio
15 |
16 | from pytgcalls import PyTgCalls, idle
17 | from pytgcalls.types import (AudioImagePiped, AudioPiped, AudioVideoPiped,
18 | LowQualityVideo, VideoPiped)
19 | from rich.console import Console
20 | from telethon import utils
21 | from youtube_dl import YoutubeDL
22 |
23 | from functions.base import TelethonFunction
24 |
25 | console = Console()
26 |
27 |
28 | class VoicePlayFunc(TelethonFunction):
29 | """Join voice chat and play audio"""
30 |
31 | async def join_and_play(self, session):
32 | await session.start()
33 |
34 | app = PyTgCalls(session)
35 | await app.start()
36 | entity = await session.get_entity(self.chat)
37 |
38 | if self.format_choice == "1":
39 | await app.join_group_call(
40 | utils.get_peer_id(entity),
41 | AudioPiped(self.media_url),
42 | )
43 |
44 | elif self.format_choice == "2":
45 | await app.join_group_call(
46 | utils.get_peer_id(entity),
47 | AudioVideoPiped(self.media_url, video_parameters=LowQualityVideo())
48 | )
49 |
50 | await idle()
51 |
52 |
53 | async def execute(self):
54 | self.ask_accounts_count()
55 |
56 | self.chat = console.input("[bold red]chat link> [/]")
57 |
58 | console.print(
59 | "\n[bold white][1] Audio\n"
60 | "[2] Video\n"
61 | )
62 |
63 | self.format_choice = console.input("[bold white]>> [/]")
64 |
65 | console.print(
66 | "\n[bold white][1] From Youtube\n"
67 | "[2] From direct link to file[/]\n"
68 | )
69 |
70 | source_choice = console.input("[bold white]>> [/]")
71 |
72 | if source_choice == "1":
73 | url = console.input("[bold red]video url> [/]")
74 | ydl = YoutubeDL()
75 |
76 | r = ydl.extract_info(url, download=False)
77 |
78 | if self.format_choice == "1":
79 | for rformat in r["formats"]:
80 | if rformat["fps"] is None:
81 | self.media_url = rformat["url"]
82 | break
83 |
84 | elif self.format_choice == "2":
85 | self.media_url = r["formats"][-1]["url"]
86 |
87 | elif source_choice == "2":
88 | self.media_url = console.input("[bold red]media url> [/]")
89 |
90 | await asyncio.gather(*[
91 | self.join_and_play(session)
92 | for session in self.sessions
93 | ])
94 |
--------------------------------------------------------------------------------
/functions/base/__init__.py:
--------------------------------------------------------------------------------
1 | from .telethon import TelethonFunction
2 | from .pyrogram import PyrogramFunction
--------------------------------------------------------------------------------
/functions/base/base.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 | import asyncio
15 | import random
16 | from rich.prompt import Prompt
17 |
18 |
19 | class BaseFunction:
20 | def parse_delay(self, string: str):
21 | return list(
22 | map(int, string.split("-"))
23 | )
24 |
25 | def ask_accounts_count(self):
26 | accounts_count = int(Prompt.ask(
27 | "[bold magenta]how many accounts to use? [/]",
28 | default=str(len(self.sessions))
29 | ))
30 |
31 | self.sessions = self.sessions[:accounts_count]
32 |
33 | async def delay(self):
34 | if len(self.settings.delay) == 1:
35 | await asyncio.sleep(self.settings.delay[0])
36 | else:
37 | await asyncio.sleep(
38 | random.randint(*self.settings.delay)
39 | )
40 |
--------------------------------------------------------------------------------
/functions/base/pyrogram.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 | import struct
15 | import base64
16 |
17 | from typing import List
18 | from pyrogram import Client
19 | from telethon import TelegramClient
20 |
21 | from modules.storages.sessions_storage import SessionsStorage
22 | from modules.settings import Settings
23 | from modules.types.json_session import JsonSession
24 | from functions.base.base import BaseFunction
25 |
26 |
27 | class PyrogramFunction(BaseFunction):
28 | PYROGRAM_STRING_SESSION_FORMAT = ">BI?256sQ?"
29 |
30 | def __init__(self, storage: SessionsStorage, settings: Settings):
31 | self.storage = storage
32 | self.settings = settings
33 |
34 | self.telethon_sessions: List[TelegramClient] = storage.sessions
35 | self.json_sessions: List[JsonSession] = storage.json_sessions
36 | self.sessions: List[Client] = []
37 |
38 | for json_session, session in zip(self.json_sessions, self.telethon_sessions):
39 | packed = struct.pack(
40 | self.PYROGRAM_STRING_SESSION_FORMAT,
41 | session.session.dc_id,
42 | settings.api_id,
43 | False,
44 | session.session.auth_key.key,
45 | 111,
46 | False
47 | )
48 |
49 | pyrogram_string_session = base64.urlsafe_b64encode(packed).decode().rstrip("=")
50 |
51 | self.sessions.append(
52 | Client(
53 | name=self.storage.get_session_path(session),
54 | api_id=json_session.account.application.api_id,
55 | api_hash=json_session.account.application.api_hash,
56 | session_string=pyrogram_string_session,
57 | app_version=json_session.account.application.app_version,
58 | device_model=json_session.account.application.device_name,
59 | system_version=json_session.account.application.sdk,
60 | lang_code=json_session.account.application.system_lang_code,
61 | in_memory=True
62 | )
63 | )
64 |
--------------------------------------------------------------------------------
/functions/base/telethon.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 | from functions.base.base import BaseFunction
15 | from modules.storages.sessions_storage import SessionsStorage
16 | from modules.settings import Settings
17 |
18 | from typing import List
19 | from telethon.sync import TelegramClient
20 |
21 | from modules.types.json_session import JsonSession
22 |
23 |
24 | class TelethonFunction(BaseFunction):
25 | def __init__(self, storage: SessionsStorage, settings: Settings):
26 | self.storage = storage
27 | self.settings = settings
28 |
29 | self.sessions: List[TelegramClient] = storage.sessions
30 |
--------------------------------------------------------------------------------
/functions/change_profile_photo.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 | import asyncio
15 | import random
16 | import os
17 |
18 | from telethon import TelegramClient, functions
19 |
20 | from rich.progress import track
21 | from rich.console import Console
22 |
23 | from functions.base import TelethonFunction
24 | console = Console()
25 |
26 |
27 | class ChangeProfilePhotoFunc(TelethonFunction):
28 | """Change profile photo"""
29 |
30 | async def set_profile_photo(self, session: TelegramClient, photo_path: str):
31 | async with self.storage.ainitialize_session(session):
32 | me = await session.get_me()
33 |
34 | try:
35 | await session(functions.photos.UploadProfilePhotoRequest(
36 | file=await session.upload_file(photo_path),
37 | ))
38 | except Exception as err:
39 | console.print(
40 | "[{name}] [bold red]Error[/] : {err}"
41 | .format(name=me.first_name, error=err)
42 | )
43 | else:
44 | console.print(
45 | "[{name}] Photo uploaded [bold green]successfully[/] ({photo_path})"
46 | .format(name=me.first_name, photo_path=photo_path)
47 | )
48 |
49 |
50 | async def execute(self):
51 | path = os.path.join(os.getcwd(), "assets", "photos")
52 | console.input(
53 | f"\n[bold white]will be used photos from folder {path}"
54 | "\nPress [Enter] to continue[/]"
55 | )
56 |
57 | photos = os.listdir(path)
58 |
59 | await asyncio.gather(*[
60 | self.set_profile_photo(session, os.path.join(path, random.choice(photos)))
61 | for session in self.sessions
62 | ])
63 |
--------------------------------------------------------------------------------
/functions/changebio.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 | import asyncio
15 | from telethon.tl.functions.account import UpdateProfileRequest
16 | from rich.console import Console
17 | from functions.base import TelethonFunction
18 |
19 | console = Console()
20 |
21 |
22 | class ChangeBioFunc(TelethonFunction):
23 | """Change bio"""
24 |
25 | async def change_bio(self, session, bio: str):
26 | async with self.storage.ainitialize_session(session):
27 | await session(
28 | UpdateProfileRequest(about=bio)
29 | )
30 |
31 | async def execute(self):
32 | bio = console.input("[bold red]bio> [/]")
33 |
34 | await asyncio.gather(*[
35 | self.change_bio(session, bio)
36 | for session in self.sessions
37 | ])
38 |
--------------------------------------------------------------------------------
/functions/changename.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 | import asyncio
15 | import random
16 |
17 | from typing import List, Tuple, Optional
18 | from telethon import TelegramClient
19 | from telethon.tl.functions.account import UpdateProfileRequest
20 | from rich.console import Console
21 | from functions.base import TelethonFunction
22 |
23 | console = Console()
24 |
25 |
26 | class ChangeNameFunc(TelethonFunction):
27 | """Change names"""
28 |
29 | @staticmethod
30 | def get_random_name(names: List[str]) -> Tuple[str, Optional[str]]:
31 | name = random.choice(names).split()
32 |
33 | if len(name) == 1:
34 | return name, None
35 |
36 | return name
37 |
38 | async def change_name(
39 | self,
40 | session: TelegramClient,
41 | account_index: int,
42 | names: Optional[List[str]] = None,
43 | first_name: Optional[str] = None,
44 | last_name: Optional[str] = None
45 | ):
46 | if names is not None:
47 | first_name, last_name = self.get_random_name(names)
48 |
49 | async with self.storage.ainitialize_session(session):
50 | me = await session.get_me()
51 |
52 | full_name = me.first_name + (" " + me.last_name if me.last_name else "")
53 |
54 | try:
55 | await session(
56 | UpdateProfileRequest(
57 | first_name=first_name,
58 | last_name=last_name or ""
59 | )
60 | )
61 | except Exception as error:
62 | console.print(f"[bold red][!][/] {error}")
63 | else:
64 | console.print(f"Name changed [bold green]successfully.[/] ( {full_name} → {first_name} {last_name or ''} )")
65 |
66 | async def execute(self):
67 | self.ask_accounts_count()
68 |
69 | from_file = console.input("[bold red]from file? (y/n)> ")
70 |
71 | if from_file == "y":
72 | with open("assets/names.txt") as file:
73 | names = file.read().strip().splitlines()
74 |
75 | await asyncio.gather(*[
76 | self.change_name(session=session, account_index=index, names=names)
77 | for index, session in enumerate(self.sessions)
78 | ])
79 |
80 | else:
81 | name = console.input("[bold red]name> [/]").split(maxsplit=1)
82 | print()
83 |
84 | first_name = name[0]
85 |
86 | if len(name) == 2:
87 | last_name = name[1]
88 | else:
89 | last_name = None
90 |
91 | await asyncio.gather(*[
92 | self.change_name(
93 | session=session,
94 | account_index=index,
95 | first_name=first_name,
96 | last_name=last_name
97 | )
98 | for index, session in enumerate(self.sessions)
99 | ])
100 |
101 |
--------------------------------------------------------------------------------
/functions/clear_chats.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 | import asyncio
15 |
16 | from telethon import functions, types, TelegramClient
17 | from rich.console import Console
18 | from rich.prompt import Confirm
19 |
20 | from functions.base import TelethonFunction
21 |
22 | console = Console()
23 |
24 |
25 | class ClearDialogsFunc(TelethonFunction):
26 | """Clear all dialogs"""
27 |
28 | async def clear(self, session: TelegramClient):
29 | async with self.storage.ainitialize_session(session):
30 | async for dialog in session.iter_dialogs():
31 | if not isinstance(dialog.entity, types.Channel):
32 | await session(functions.messages.DeleteHistoryRequest(
33 | peer=dialog.entity,
34 | max_id=0,
35 | just_clear=True,
36 | revoke=True
37 | ))
38 | else:
39 | await session(
40 | functions.channels.LeaveChannelRequest(dialog.id)
41 | )
42 |
43 | console.log(f"Dialog {dialog.id} | {dialog.title} has been deleted")
44 |
45 | async def execute(self):
46 | confirm = Confirm.ask("[bold red]are you sure?[/]")
47 |
48 | if confirm:
49 | await asyncio.gather(*[
50 | self.clear(session)
51 | for session in self.sessions
52 | ])
53 |
54 |
--------------------------------------------------------------------------------
/functions/flood.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 | import asyncio
15 | import os
16 | import random
17 | from rich.prompt import Prompt, Confirm
18 | from rich.console import Console
19 | from multiprocessing import Process
20 | from telethon import events, types
21 | from telethon.tl.functions.messages import GetStickerSetRequest
22 | from telethon.tl.types import InputStickerSetShortName
23 |
24 | from functions.base import TelethonFunction
25 | console = Console()
26 |
27 | class Flood(TelethonFunction):
28 | def __init__(self, storage, settings):
29 | super().__init__(storage, settings)
30 |
31 | self.choice = None
32 | self.function = None
33 |
34 | self.modes = (
35 | ("Raid with text", self.text_flood),
36 | ("Single bot raid", self.text_flood),
37 | ("Raid with media", self.gif_flood),
38 | ("Raid with reply", self.reply_flood),
39 | ("Raid with stickers", self.stickers_flood)
40 | )
41 |
42 | self.reply_msg_id = 0
43 |
44 | async def stickers_flood(self, session, peer, text):
45 | stickers = await session(
46 | GetStickerSetRequest(
47 | stickerset=InputStickerSetShortName(
48 | short_name=self.sticker_set
49 | )
50 | )
51 | )
52 |
53 | await session.send_file(peer, random.choice(stickers.documents))
54 |
55 | await session.send_message(
56 | peer,
57 | text,
58 | parse_mode="html"
59 | )
60 |
61 | async def text_flood(self, session, peer, text):
62 | await session.send_message(
63 | peer,
64 | text,
65 | parse_mode="html"
66 | )
67 |
68 | async def reply_flood(self, session, peer, text):
69 | await session.send_message(
70 | peer,
71 | text,
72 | reply_to=self.reply_msg_id,
73 | parse_mode="html"
74 | )
75 |
76 | async def gif_flood(self, session, peer, text):
77 | file = random.choice(os.listdir("media"))
78 |
79 | await session.send_file(
80 | peer,
81 | os.path.join("media", file),
82 | caption=text,
83 | parse_mode="html"
84 | )
85 |
86 | async def flood(self, session, peer, function):
87 | if not self.storage.initialize:
88 | await session.connect()
89 |
90 | users = []
91 | admins = []
92 |
93 | admin_links = []
94 |
95 | count = 0
96 | errors = 0
97 | me = await session.get_me()
98 |
99 | if self.mention_all:
100 | admins = await session.get_participants(
101 | peer,
102 | filter=types.ChannelParticipantsAdmins
103 | )
104 |
105 | if self.mention_mode == "users":
106 | users = [
107 | user for user in await session.get_participants(peer)
108 | if user not in admins
109 | ]
110 |
111 | users_links = [
112 | f"\u206c\u206f"
113 | for user in users
114 | ]
115 |
116 | admin_links = [
117 | f"\u206c\u206f"
118 | for user in admins
119 | ]
120 |
121 |
122 | while count < self.settings.messages_count \
123 | or self.settings.messages_count == 0:
124 | if not self.mention_all:
125 | text = random.choice(self.settings.messages)
126 | else:
127 | if function is not self.gif_flood:
128 | text = random.choice(self.settings.messages) + \
129 | "\u206c\u206f".join(
130 | random.sample(users_links, 10) if self.mention_mode == "users"
131 | else random.sample(admin_links, 2)
132 | )
133 | else:
134 | text = random.choice(self.settings.messages) + \
135 | "\u206c\u206f".join(
136 | random.sample(users_links, 10) if self.mention_mode == "users"
137 | else random.sample(admin_links, 2)
138 | )
139 |
140 | try:
141 | await function(session, peer, text)
142 | except Exception as err:
143 | console.print(
144 | "[{name}] [bold red]not sent.[/] [bold white]{err}[/]"
145 | .format(name=me.first_name, err=err)
146 | )
147 |
148 | errors += 1
149 |
150 | if errors >= 3:
151 | try:
152 | await session.delete_dialog(peer)
153 | except Exception as err:
154 | console.print(f"[bold red]ERROR[/] while leaving from chat: {err}")
155 |
156 | break
157 |
158 | else:
159 | count += 1
160 | console.print(
161 | "[{name}] [bold green]sent.[/] COUNT: [yellow]{count}[/]"
162 | .format(name=me.first_name, count=count)
163 | )
164 | finally:
165 | await self.delay()
166 |
167 | def handle(self, session, function):
168 | @session.on(events.NewMessage)
169 | async def handler(message: types.Message):
170 | if message.raw_text == self.settings.trigger:
171 | await self.flood(
172 | session,
173 | message.chat_id,
174 | function,
175 | )
176 |
177 | if message.reply_to:
178 | self.reply_msg_id = message.reply_to.reply_to_msg_id
179 |
180 | if not self.storage.initialize:
181 | session.start()
182 |
183 | session.run_until_disconnected()
184 |
185 | def ask(self):
186 | for index, mode in enumerate(self.modes):
187 | console.print(
188 | "[bold white][{index}] {description}[/]"
189 | .format(index=index + 1, description=mode[0]),
190 | )
191 |
192 | choice = console.input(
193 | "[bold white]>> [/]"
194 | )
195 |
196 | while not choice.isdigit():
197 | choice = console.input(
198 | "[bold white]>> [/]"
199 | )
200 |
201 | else:
202 | self.choice = int(choice) - 1
203 |
204 | self.function = self.modes[self.choice][1]
205 | self.ask_accounts_count()
206 |
207 | if self.choice == 4:
208 | self.sticker_set = console.input("[bold red]enter link to sticker set (e.g https://t.me/addstickers/AlbinoEmoji)> [/]")
209 | self.sticker_set = self.sticker_set.replace("https://t.me/addstickers/", "")
210 |
211 | delay = Prompt.ask(
212 | "[bold red]delay[/]",
213 | default="-".join(str(x) for x in self.settings.delay)
214 | )
215 |
216 | self.settings.delay = self.parse_delay(delay)
217 | self.mention_all = Confirm.ask("[bold red]mention all?[/]", default="y")
218 |
219 | if self.mention_all:
220 | self.mention_mode = Prompt.ask(
221 | "[bold red]mention mode[/]",
222 | choices=["admins", "users"]
223 | )
224 |
225 | return self.choice
226 |
227 | async def start_single_raid(self, sessions, link):
228 | for session in sessions:
229 | await session.connect()
230 |
231 | await self.flood(
232 | session,
233 | link,
234 | self.function,
235 | )
236 |
237 | def start_processes(self):
238 | if self.choice == 1:
239 | link = Prompt.ask("[bold red]link to chat[/]")
240 |
241 | asyncio.get_event_loop().run_until_complete(self.start_single_raid(self.sessions, link))
242 |
243 | processes = []
244 |
245 | for session in self.sessions:
246 | if self.choice != 1:
247 | process = Process(
248 | target=self.handle, args=[session, self.function]
249 | )
250 |
251 | process.start()
252 | processes.append(process)
253 |
254 |
255 | if self.choice != 1:
256 | console.print(
257 | "[bold white][*] Send «[green]{trigger}[/]» to chat[/]"
258 | .format(trigger=self.settings.trigger)
259 | )
260 |
261 | for process in processes:
262 | process.join()
263 |
264 |
--------------------------------------------------------------------------------
/functions/flood_chat.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 | from functions.base import TelethonFunction
15 | from functions.flood import Flood
16 |
17 | class FloodFunc(TelethonFunction):
18 | """Flood to chat"""
19 |
20 | def execute(self):
21 | flood = Flood(self.storage, self.settings)
22 |
23 | flood.ask()
24 | flood.start_processes()
25 |
26 |
--------------------------------------------------------------------------------
/functions/flood_comments.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 | import os
15 | import random
16 | import asyncio
17 | from rich.prompt import Prompt, Confirm
18 | from rich.console import Console
19 |
20 | from functions.base import TelethonFunction
21 | console = Console()
22 |
23 |
24 | class CommentsFloodFunc(TelethonFunction):
25 | """Flood to channel comments"""
26 |
27 | async def flood(self, session, channel, post_id, media):
28 | await session.connect()
29 | me = await session.get_me()
30 | count = 0
31 | errors = 0
32 |
33 | while count < self.settings.messages_count \
34 | or self.settings.messages_count == 0:
35 | text = random.choice(self.settings.messages)
36 |
37 | try:
38 | if not media:
39 | await session.send_message(
40 | channel,
41 | text,
42 | comment_to=post_id,
43 | parse_mode="html"
44 | )
45 | else:
46 | file = random.choice(os.listdir("media"))
47 |
48 | await session.send_file(
49 | channel,
50 | os.path.join("media", file),
51 | comment_to=post_id,
52 | caption=text,
53 | parse_mode="html"
54 | )
55 | except Exception as err:
56 | console.print(
57 | "[{name}] [bold red]not sent.[/] {err}"
58 | .format(name=me.first_name, err=err)
59 | )
60 |
61 | errors += 1
62 |
63 | if errors >= 5:
64 | break
65 | else:
66 | count += 1
67 | console.print(
68 | "[{name}] [bold green]sent.[/] COUNT: [yellow]{count}[/]"
69 | .format(name=me.first_name, count=count)
70 | )
71 | finally:
72 | await self.delay()
73 |
74 | async def execute(self):
75 | self.ask_accounts_count()
76 |
77 | link = console.input("[bold red]link to post> [/]")
78 |
79 | delay = Prompt.ask(
80 | "[bold red]delay[/]",
81 | default="-".join(str(x) for x in self.settings.delay)
82 | )
83 |
84 | media = Confirm.ask("[bold red]media[/]")
85 | from_config = Confirm.ask("[bold red]use messages from config?[/]")
86 |
87 | if not from_config:
88 | self.settings.messages = [console.input("[bold red]message: [/]")]
89 |
90 | self.settings.delay = self.parse_delay(delay)
91 |
92 | channel = "/" .join(link.split("/")[:-1])
93 | post_id = link.split("/")[-1]
94 |
95 | await asyncio.gather(*[
96 | self.flood(session, channel, int(post_id), media)
97 | for session in self.sessions
98 | ])
99 |
--------------------------------------------------------------------------------
/functions/flood_without_trigger.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 | import asyncio
15 | from functions.base import TelethonFunction
16 | from functions.flood import Flood
17 | from rich.console import Console
18 |
19 | console = Console()
20 |
21 |
22 | class FloodWithoutTriggerFunc(TelethonFunction):
23 | """Flood without trigger (asyncio)"""
24 |
25 | async def execute(self):
26 | link = console.input("[bold red]link> [/]")
27 | flood = Flood(self.storage, self.settings)
28 | flood.ask()
29 |
30 | await asyncio.gather(*[
31 | flood.flood(session, link, flood.function)
32 | for session in self.sessions
33 | ])
34 |
--------------------------------------------------------------------------------
/functions/inviting.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 |
3 | # Copyright (C) 2023 json1c
4 |
5 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
6 | # as published by the Free Software Foundation, either version 3 of the License
7 |
8 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 | # See the GNU General Public License for more details.
11 |
12 | # You should have received a copy of the GNU General Public License along with this program.
13 | # If not, see .
14 |
15 | import asyncio
16 |
17 | from telethon.tl.functions.messages import ImportChatInviteRequest
18 | from telethon.tl.functions.channels import JoinChannelRequest, InviteToChannelRequest
19 | from telethon.errors import PeerFloodError, UserPrivacyRestrictedError
20 |
21 | from rich.prompt import Prompt
22 | from rich.console import Console
23 |
24 | from functions.base import TelethonFunction
25 | console = Console()
26 |
27 |
28 | class InvitingFunc(TelethonFunction):
29 | """Invite users from supergroup"""
30 |
31 | @staticmethod
32 | def transform_to_valid_invite(link):
33 | if "t.me" in link:
34 | if "joinchat" in link:
35 | invite = link.split("/")[-1]
36 | else:
37 | invite = "@" + link.split("/")[-1]
38 | elif link.startswith("@"):
39 | invite = link
40 |
41 | return invite
42 |
43 | @staticmethod
44 | def chunkify(lst, n): # split list
45 | return [lst[i::n] for i in range(n)]
46 |
47 | async def invite(self, users, channel, session):
48 | users_for_invite = []
49 |
50 | async with self.storage.ainitialize_session(session):
51 | channel = await session.get_entity(channel)
52 | for user in users:
53 | if user.username:
54 | user = await session.get_entity(user.username)
55 | users_for_invite.append(user)
56 |
57 | for user in users_for_invite:
58 | try:
59 | await session(InviteToChannelRequest(
60 | channel=channel,
61 | users=[user]
62 | ))
63 | except PeerFloodError as err:
64 | console.print(f"[bold red]{err}[/]")
65 | return
66 | except UserPrivacyRestrictedError:
67 | pass
68 |
69 | async def execute(self):
70 | accounts_count = int(Prompt.ask(
71 | "[bold magenta]how many accounts to use?[/]",
72 | default=str(len(self.sessions))
73 | ))
74 |
75 | self.sessions = self.sessions[:accounts_count]
76 |
77 | link = console.input("[bold red]link to chat> [/]")
78 | invite = self.transform_to_valid_invite(link)
79 |
80 | session = None
81 |
82 | with console.status("Parsing users...", spinner="dots"):
83 | for session in self.sessions:
84 | await session.connect()
85 |
86 | try:
87 | if "@" in invite:
88 | await session(JoinChannelRequest(invite))
89 | else:
90 | await session(ImportChatInviteRequest(invite))
91 | except Exception as err:
92 | console.print(err)
93 | await session.disconnect()
94 | continue
95 | else:
96 | break
97 |
98 | users = await session.get_participants(link, aggressive=False)
99 |
100 | console.print(
101 | "[bold green][*] Parsed {} users[/]"
102 | .format(len(users))
103 | )
104 |
105 | users = self.chunkify(users, len(self.sessions))
106 |
107 | link = console.input("[bold red]where to invite users> [/]")
108 |
109 | with console.status("Inviting...", spinner="dots"):
110 | await asyncio.gather(*[
111 | self.invite(users_chunk, link, session)
112 | for session, users_chunk in zip(self.sessions, users)
113 | ])
114 |
115 |
--------------------------------------------------------------------------------
/functions/joiner.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 | import random
15 | import asyncio
16 |
17 | from rich.progress import track
18 | from rich.console import Console
19 | from rich.prompt import Prompt, Confirm
20 |
21 | from time import perf_counter
22 |
23 | from telethon import events, types
24 | from telethon.tl.functions.messages import ImportChatInviteRequest
25 | from telethon.tl.functions.channels import JoinChannelRequest
26 | from telethon.tl.functions.channels import GetFullChannelRequest
27 | from telethon.sync import TelegramClient
28 |
29 | from functions.flood import Flood
30 | from functions.base import TelethonFunction
31 |
32 | console = Console()
33 |
34 |
35 | class JoinerFunc(TelethonFunction):
36 | """Join chat"""
37 |
38 | async def join(self, session, link, index, mode):
39 | if mode == "1":
40 | try:
41 | if not "joinchat" in link:
42 | await session(JoinChannelRequest(link))
43 | else:
44 | invite = link.split("/")[-1]
45 | await session(ImportChatInviteRequest(invite))
46 | except Exception as error:
47 | print(f"[-] [acc {index + 1}] {error}")
48 | else:
49 | return True
50 |
51 | elif mode == "2":
52 | try:
53 | channel = await session(GetFullChannelRequest(link))
54 | chat = channel.chats[1]
55 | await session(JoinChannelRequest(chat))
56 | except Exception as error:
57 | print(f"[-] [acc {index + 1}] {error}")
58 | else:
59 | return True
60 |
61 | async def solve_captcha(self, session: TelegramClient):
62 | session.add_event_handler(
63 | self.on_message,
64 | events.NewMessage
65 | )
66 |
67 | await session.run_until_disconnected()
68 |
69 | async def on_message(self, msg: types.Message):
70 | if msg.mentioned:
71 | if msg.reply_markup:
72 | captcha = msg.reply_markup.rows[0] \
73 | .buttons[0].data.decode("utf-8")
74 |
75 | await msg.click(data=captcha)
76 |
77 | async def execute(self):
78 | self.ask_accounts_count()
79 |
80 | print()
81 |
82 | console.print(
83 | "[1] Just join chat/channel",
84 | "[2] Join linked to channel chat",
85 | sep="\n",
86 | style="bold white"
87 | )
88 |
89 | print()
90 |
91 | mode = console.input("[bold red]mode> [/]")
92 | link = console.input("[bold red]link> [/]")
93 |
94 | link = link.replace("+", "joinchat/")
95 |
96 | speed = Prompt.ask(
97 | "[bold red]speed>[/]",
98 | choices=["normal", "fast"]
99 | )
100 |
101 | flood = Confirm.ask("[bold red]flood instantly?[/]")
102 |
103 | if flood:
104 | flood_func = Flood(self.storage, self.settings)
105 | function_index = flood_func.ask()
106 |
107 | else:
108 | function_index = None
109 |
110 | joined = 0
111 |
112 | if speed == "normal":
113 | delay = Prompt.ask("[bold red]delay[/]", default="0")
114 | captcha = Confirm.ask("[bold red]captcha[/]")
115 |
116 | start = perf_counter()
117 |
118 | if function_index != 1:
119 | for index, session in track(
120 | enumerate(self.sessions),
121 | "[yellow]Joining[/]",
122 | total=len(self.sessions)
123 | ):
124 | await session.start()
125 |
126 | if captcha:
127 | asyncio.create_task(
128 | self.solve_captcha(session)
129 | )
130 |
131 | is_joined = await self.join(session, link, index, mode)
132 |
133 | if is_joined:
134 | joined += 1
135 |
136 | await asyncio.sleep(int(delay))
137 |
138 | elif function_index == 1:
139 | for index, session in enumerate(self.sessions):
140 | await session.start()
141 |
142 | if captcha:
143 | asyncio.create_task(
144 | self.solve_captcha(session)
145 | )
146 |
147 | is_joined = await self.join(session, link, index, mode)
148 |
149 | console.print("[bold green]Bot joined[/]")
150 |
151 | if is_joined:
152 | joined += 1
153 |
154 | console.print("[bold white]Starting flood[/]")
155 |
156 | await flood_func.flood(session, link, flood_func.function)
157 | await asyncio.sleep(int(delay))
158 |
159 | if speed == "fast":
160 | if not self.storage.initialize:
161 | for session in track(
162 | self.sessions,
163 | "[yellow]Initializing sessions[/]",
164 | total=len(self.sessions)
165 | ):
166 | await session.connect()
167 |
168 | with console.status("Joining"):
169 | start = perf_counter()
170 |
171 | results = await asyncio.gather(*[
172 | self.join(session, link, index, mode)
173 | for index, session in enumerate(self.sessions)
174 | ])
175 |
176 | for result in results:
177 | if result:
178 | joined += 1
179 |
180 |
181 | joined_time = round(perf_counter() - start, 2)
182 | console.print(f"[+] {joined} bots joined in [yellow]{joined_time}[/]s")
183 |
184 | if flood and function_index != 1:
185 | await asyncio.gather(*[
186 | flood_func.flood(session, link, flood_func.function)
187 | for session in self.sessions
188 | ])
189 |
--------------------------------------------------------------------------------
/functions/kick_all_sessions.py:
--------------------------------------------------------------------------------
1 | import asyncio
2 |
3 | from rich.progress import track
4 | from rich.console import Console
5 |
6 | from telethon.tl.functions.account import GetAuthorizationsRequest, ResetAuthorizationRequest
7 | from telethon import TelegramClient
8 |
9 | from functions.base import TelethonFunction
10 |
11 | console = Console()
12 |
13 |
14 | class KickAllSessionsFunc(TelethonFunction):
15 | """Kick all users from sessions"""
16 |
17 | async def kick_all_sessions(self, session: TelegramClient):
18 | async with self.storage.ainitialize_session(session):
19 | try:
20 | authorizations = await session(GetAuthorizationsRequest())
21 | except Exception as error:
22 | console.print(f"Error while getting authorizations : {error}")
23 | return
24 |
25 | for authorization in authorizations.authorizations:
26 | if authorization.hash != 0:
27 | try:
28 | await session(ResetAuthorizationRequest(hash=authorization.hash))
29 | except Exception as error:
30 | console.print(f"Error : {error}")
31 | else:
32 | console.print(f"Resetted authorization {authorization.ip} ({authorization.device_model}, {authorization.platform})")
33 |
34 | async def execute(self):
35 | await asyncio.gather(*[
36 | self.kick_all_sessions(session)
37 | for session in track(self.sessions, "Kicking...")
38 | ])
39 |
--------------------------------------------------------------------------------
/functions/pmflood.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 | import asyncio
15 | import random
16 | import os
17 | from telethon import functions, types
18 | from rich.prompt import Prompt, Confirm
19 | from rich.console import Console
20 |
21 | from functions.base import TelethonFunction
22 |
23 | console = Console()
24 |
25 |
26 | class PmFloodFunc(TelethonFunction):
27 | """Flood to PM"""
28 |
29 | async def flood(self, session, peer, text, media, by_phone_number):
30 | count = 0
31 | errors = 0
32 |
33 | async with self.storage.ainitialize_session(session):
34 | try:
35 | me = await session.get_me()
36 | except:
37 | return
38 |
39 | if by_phone_number:
40 | result = await session(functions.contacts.ImportContactsRequest(
41 | contacts=[types.InputPhoneContact(
42 | client_id=random.randrange(-2**63, 2**63),
43 | phone=peer,
44 | first_name='owned by huis',
45 | last_name=''
46 | )]
47 | ))
48 |
49 | peer = result.users[0]
50 |
51 | while True:
52 | try:
53 | if not media:
54 | await session.send_message(peer, text)
55 | else:
56 | file = random.choice(os.listdir("media"))
57 |
58 | await session.send_file(
59 | peer,
60 | os.path.join("media", file),
61 | caption=text,
62 | parse_mode="html"
63 | )
64 | except Exception as err:
65 | console.print(
66 | "[{name}] [bold red]not sent.[/] {err}"
67 | .format(name=me.first_name, err=err)
68 | )
69 |
70 | if errors >= 5:
71 | break
72 |
73 | errors += 1
74 | else:
75 | count += 1
76 | console.print(
77 | "[{name}] [bold green]sent.[/] COUNT: [yellow]{count}[/]"
78 | .format(name=me.first_name, count=count)
79 | )
80 | finally:
81 | await self.delay()
82 |
83 | async def execute(self):
84 | self.ask_accounts_count()
85 |
86 | console.print()
87 | console.print("[bold white][1] Flood by username")
88 | console.print("[bold white][2] Flood by phone number")
89 | choice = console.input("\n[bold white]>> ")
90 |
91 | by_phone_number = False
92 |
93 | if choice == "1":
94 | peer = console.input("[bold red]enter username> [/]")
95 | elif choice == "2":
96 | by_phone_number = True
97 | peer = console.input("[bold red]enter phone number> [/]")
98 | else:
99 | console.print("[bold red]Invalid input!")
100 | return
101 |
102 | media = Confirm.ask("[bold red]media")
103 | text = console.input("[bold red]text> [/]")
104 |
105 | delay = Prompt.ask(
106 | "[bold red]delay[/]",
107 | default="-".join(str(x) for x in self.settings.delay)
108 | )
109 |
110 | self.settings.delay = self.parse_delay(delay)
111 |
112 | await asyncio.gather(*[
113 | self.flood(session, peer, text, media, by_phone_number=by_phone_number)
114 | for session in self.sessions
115 | ])
116 |
--------------------------------------------------------------------------------
/functions/poll_vote.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 | import asyncio
15 | from rich.console import Console
16 |
17 | from telethon import functions
18 | from functions.base import TelethonFunction
19 |
20 | console = Console()
21 |
22 |
23 | class PollVoteFunc(TelethonFunction):
24 | """Vote in poll"""
25 |
26 | async def vote(self, session, channel, post_id, option_number):
27 | if not self.storage.initialize:
28 | await session.connect()
29 |
30 | await session(
31 | functions.messages.SendVoteRequest(
32 | peer=channel,
33 | msg_id=post_id,
34 | options=[str(option_number)]
35 | )
36 | )
37 |
38 | async def execute(self):
39 | self.ask_accounts_count()
40 |
41 | post_link = console.input("[bold red]enter link to msg/post> ")
42 | option_number = int(console.input("[bold red]enter answer number (e.g 1, 2)> ")) - 1
43 |
44 | channel = post_link.split("/")[-2]
45 | post_id = int(post_link.split("/")[-1])
46 |
47 | with console.status("Voting"):
48 | await asyncio.gather(*[
49 | self.vote(session, channel, post_id, option_number)
50 | for session in self.sessions
51 | ])
52 |
53 |
54 |
--------------------------------------------------------------------------------
/functions/reactions.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 | import asyncio
15 | import random
16 |
17 | from pyrogram import Client
18 | from functions.base import PyrogramFunction
19 | from rich.console import Console
20 |
21 | console = Console()
22 |
23 |
24 | class ReactionsFunc(PyrogramFunction):
25 | """Set reactions to message/post"""
26 |
27 | reactions = ['👍', '❤️', '🔥', '🥰', '👏', '😁', '🎉', '🤩', '👎', '🤯', '😱', '🤬', '😢', '🤮', '💩', '🙏']
28 |
29 | async def set_reaction(self, session: Client, chat_username: str, message_id: int, reaction=None):
30 | if not reaction:
31 | reaction = random.choice(self.reactions)
32 |
33 | async with session:
34 | try:
35 | await session.send_reaction(
36 | chat_id=chat_username,
37 | message_id=int(message_id),
38 | emoji=reaction
39 | )
40 | except Exception as err:
41 | console.print(f"[bold red][ERROR][/] [bold yellow][{session.me.id}][/] : {err}")
42 | else:
43 | console.print(f"[bold green][SUCCESS] [{session.me.id}][/] : Reaction \"{reaction}\" was sent")
44 |
45 |
46 | async def execute(self):
47 | link_to_message = console.input("[bold red]link to msg/post> [/]")
48 | chat_username, message_id = link_to_message.split("/")[-2:]
49 |
50 | reaction = console.input(
51 | "[bold red]enter reaction ({reactions}) or skip for random> [/]"
52 | .format(reactions=", ".join(self.reactions))
53 | )
54 |
55 | await asyncio.gather(*[
56 | self.set_reaction(
57 | session=session,
58 | chat_username=chat_username,
59 | message_id=message_id,
60 | reaction=reaction
61 | )
62 | for session in self.sessions
63 | ])
64 |
--------------------------------------------------------------------------------
/functions/report.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 | from rich.progress import track
15 | from rich.console import Console
16 | from rich.prompt import Prompt
17 |
18 | from telethon import types, functions
19 | from functions.base import TelethonFunction
20 |
21 | console = Console()
22 |
23 | class ReportFunc(TelethonFunction):
24 | """Report message/post"""
25 |
26 | def __init__(self, storage, settings):
27 | super().__init__(storage, settings)
28 |
29 | self.reasons = (
30 | ("Child abuse", types.InputReportReasonChildAbuse()),
31 | ("Copyright", types.InputReportReasonCopyright()),
32 | ("Fake channel/account", types.InputReportReasonFake()),
33 | ("Pornography", types.InputReportReasonPornography()),
34 | ("Spam", types.InputReportReasonSpam()),
35 | ("Violence", types.InputReportReasonViolence()),
36 | ("Other", types.InputReportReasonOther())
37 | )
38 |
39 | async def execute(self):
40 | self.ask_accounts_count()
41 |
42 | link = Prompt.ask("[bold red]link[/]")
43 | posts = Prompt.ask("[bold red]enter the post ids[/]")
44 | posts = [int(i) for i in posts.split(",")]
45 |
46 | print()
47 |
48 | for index, reasons in enumerate(self.reasons):
49 | reason, _ = reasons
50 |
51 | console.print(
52 | "[bold white][{}] {}[/]"
53 | .format(index + 1, reason)
54 | )
55 |
56 | print()
57 |
58 | choice = int(console.input("[bold white]>> [/]"))
59 | reason_type = self.reasons[choice - 1][1]
60 |
61 | comment = console.input("[bold red]comment> [/]")
62 |
63 | for index, session in track(
64 | enumerate(self.sessions),
65 | "[yellow]Reporting...[/]",
66 | total=len(self.sessions)
67 | ):
68 | async with self.storage.ainitialize_session(session):
69 | me = await session.get_me()
70 | try:
71 | await session(
72 | functions.messages.ReportRequest(
73 | peer=link,
74 | id=posts,
75 | reason=reason_type,
76 | message=comment
77 | )
78 | )
79 | except Exception as err:
80 | console.print(
81 | "[{name}] [bold red]error.[/] {error}"
82 | .format(name=me.first_name, error=err)
83 | )
84 |
--------------------------------------------------------------------------------
/functions/report_user.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 | from rich.progress import track
15 | from rich.console import Console
16 | from rich.prompt import Prompt
17 |
18 | from telethon import types, functions
19 | from functions.base import TelethonFunction
20 |
21 | console = Console()
22 |
23 | class ReportFunc(TelethonFunction):
24 | """Report the bot/user"""
25 |
26 | def __init__(self, storage, settings):
27 | super().__init__(storage, settings)
28 |
29 | self.reasons = (
30 | ("Child abuse", types.InputReportReasonChildAbuse()),
31 | ("Copyright", types.InputReportReasonCopyright()),
32 | ("Fake channel/account", types.InputReportReasonFake()),
33 | ("Pornography", types.InputReportReasonPornography()),
34 | ("Spam", types.InputReportReasonSpam()),
35 | ("Violence", types.InputReportReasonViolence()),
36 | ("Other", types.InputReportReasonOther())
37 | )
38 |
39 | async def execute(self):
40 | self.ask_accounts_count()
41 |
42 | link = Prompt.ask("[bold red]username>[/]")
43 |
44 | print()
45 |
46 | for index, reasons in enumerate(self.reasons):
47 | reason, _ = reasons
48 |
49 | console.print(
50 | "[bold white][{}] {}[/]"
51 | .format(index + 1, reason)
52 | )
53 |
54 | print()
55 |
56 | choice = int(console.input("[bold white]>> [/]"))
57 | reason_type = self.reasons[choice - 1][1]
58 |
59 | comment = console.input("[bold red]comment> [/]")
60 |
61 | for index, session in track(
62 | enumerate(self.sessions),
63 | "[yellow]Reporting...[/]",
64 | total=len(self.sessions)
65 | ):
66 | async with self.storage.ainitialize_session(session):
67 | me = await session.get_me()
68 | try:
69 | await session(
70 | functions.account.ReportPeerRequest(
71 | peer=link,
72 | reason=reason_type,
73 | message=comment
74 | )
75 | )
76 | except Exception as err:
77 | console.print(
78 | "[{name}] [bold red]error.[/] {error}"
79 | .format(name=me.first_name, error=err)
80 | )
81 |
--------------------------------------------------------------------------------
/functions/spamblock.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 | import asyncio
15 | import os
16 | import re
17 |
18 | from typing import Dict, List
19 |
20 | from rich.prompt import Confirm
21 | from rich.console import Console
22 |
23 | from telethon.errors import YouBlockedUserError
24 | from telethon.sync import TelegramClient
25 | from telethon.tl.functions.contacts import UnblockRequest
26 |
27 | from functions.base import TelethonFunction
28 |
29 | console = Console()
30 |
31 |
32 | class SpamBlockFunc(TelethonFunction):
33 | """Check accounts status"""
34 |
35 | async def check(self, session: TelegramClient):
36 | async with self.storage.ainitialize_session(session):
37 | try:
38 | await session.send_message("SpamBot", "/start")
39 | except YouBlockedUserError:
40 | await session(UnblockRequest("spambot"))
41 | return await self.check(session)
42 |
43 | except Exception as err:
44 | console.print(f"[bold red][!] {err}[/]")
45 | return
46 |
47 | await asyncio.sleep(0.5)
48 | messages = await session.get_messages("SpamBot", limit=1)
49 |
50 | text = messages[0].message
51 | lines = text.split("\n")
52 |
53 | if len(lines) == 1:
54 | console.print("[bold green][+] Account without spam block[/]")
55 |
56 | else:
57 | result = re.findall(r"\d+\s\w+\s\d{4}", text)
58 |
59 | if not result:
60 | console.print(f"[bold red][-] Account with permanent spam block[/]")
61 | return "permanent", session
62 | else:
63 | date = result[0]
64 | console.print(f"[bold red][-] Account with spam block: {date}[/]")
65 | return result[0], session
66 |
67 | async def execute(self):
68 | blocks: Dict[str, List[TelegramClient]] = {}
69 |
70 | results = await asyncio.gather(*[
71 | self.check(session)
72 | for session in self.sessions
73 | ])
74 |
75 | for result in results:
76 | if result is None:
77 | continue
78 |
79 | date, session = result
80 |
81 | if not blocks.get(date):
82 | blocks[date] = []
83 |
84 | blocks[date].append(session)
85 |
86 | move_sessions = Confirm.ask("[bold magenta]Move restricted sessions to other folders?[/]")
87 |
88 | if move_sessions:
89 | if not os.path.exists("sessions/spamblock"):
90 | os.mkdir("sessions/spamblock")
91 |
92 | for date, sessions in blocks.items():
93 | for session in sessions:
94 | path = os.path.join("sessions", "spamblock", date)
95 |
96 | if not os.path.exists(path):
97 | os.mkdir(path)
98 |
99 | session_path = self.storage.get_session_path(session)
100 | session_name = os.path.basename(session_path)
101 |
102 | os.rename(
103 | session_path,
104 | os.path.join(path, session_name)
105 | )
106 |
107 |
--------------------------------------------------------------------------------
/functions/statistics_phones.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2021 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 | import asyncio
15 | import phonenumbers
16 |
17 | from phonenumbers import geocoder
18 | from collections import Counter
19 |
20 | from rich.table import Table
21 | from rich.console import Console
22 |
23 | from functions.base import TelethonFunction
24 |
25 | console = Console()
26 |
27 |
28 | class PhoneNumbersStatsFunc(TelethonFunction):
29 | """Statistics (phone numbers)"""
30 |
31 | async def get_phone_number(self, session):
32 | try:
33 | await session.connect()
34 | except Exception:
35 | return
36 | else:
37 | me = await session.get_me()
38 | return me.phone
39 |
40 | async def execute(self):
41 | with console.status("Wait..."):
42 | phones = await asyncio.gather(*[
43 | self.get_phone_number(session)
44 | for session in self.sessions
45 | ])
46 |
47 | countries = []
48 | countries_by_country_code = {}
49 |
50 | table = Table()
51 |
52 | table.add_column("Phone country code", justify="left", style="white")
53 | table.add_column("Country", style="white")
54 | table.add_column("Count", justify="center", style="white")
55 |
56 | for phone in phones:
57 | if phone is not None:
58 | try:
59 | parsed_phone = phonenumbers.parse(f"+{phone}", None)
60 | except Exception:
61 | continue
62 |
63 | country = geocoder.description_for_number(parsed_phone, "en")
64 |
65 | if not countries_by_country_code.get(parsed_phone.country_code):
66 | countries_by_country_code[parsed_phone.country_code] = country
67 |
68 | countries.append(parsed_phone.country_code)
69 |
70 | countries = Counter(countries)
71 |
72 | for country_code, count in countries.items():
73 | country_name = countries_by_country_code[country_code]
74 |
75 | if not country_name:
76 | country_name = "N/A"
77 |
78 | table.add_row(
79 | str(country_code), country_name, str(count)
80 | )
81 |
82 | console.print(table)
83 |
--------------------------------------------------------------------------------
/main.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 | import locale
15 | import sys
16 |
17 | from rich.console import Console
18 |
19 | from modules import updater
20 | from modules.settings import Settings
21 | from modules.storages.functions_storage import FunctionsStorage
22 | from modules.storages.sessions_storage import SessionsStorage
23 |
24 | console = Console()
25 |
26 | console.print("""
27 | [bold magenta]Copyright (C) 2024 https://github.com/json1c/telegram-raid-botnet
28 | This program comes with ABSOLUTELY NO WARRANTY.
29 | This is free software, and you are welcome to redistribute it under certain conditions.[/]
30 | """)
31 |
32 | console.print("Author's channel: [link=https://t.me/+eht9VReFK_FmZGVi]https://t.me/+eht9VReFK_FmZGVi")
33 | console.print("To buy private functions, contact [link=https://t.me/json1c]https://t.me/json1c\n")
34 |
35 | if "UTF-8" not in locale.getlocale():
36 | console.print("[bold yellow]WARNING:[/] You don't have UTF-8 encoding. Botnet may not work")
37 | console.print("Follow this instruction: https://teletype.in/@huis_bn/botnet-faq#Oxdr")
38 |
39 | with console.status("Checking updates..."):
40 | update = updater.check_update()
41 |
42 | if update["has_update"]:
43 | current_commit = update["current_commit"]
44 | upcoming_commit = update["upcoming_commit"]
45 | message = update["message"]
46 |
47 | console.print("[bold white]A new botnet update has been released.[/]")
48 |
49 | console.print(
50 | "[yellow]{current_commit}[/] → [green]{upcoming_commit}[/] : [white]{message}[/]"
51 | .format(current_commit=current_commit[:8], upcoming_commit=upcoming_commit[:8], message=message)
52 | )
53 |
54 | install_choice = console.input("[bold white]Install? (y/n) >> [/]")
55 |
56 | if install_choice == "y":
57 | updater.update(console)
58 |
59 | else:
60 | console.print("You using the latest version of botnet :)")
61 |
62 | if sys.version_info < (3, 8, 0):
63 | console.print("\n[red]Error: you using an outdated Python version. Install Python 3.8.0 at least.")
64 | else:
65 | if sys.platform == "win32":
66 | console.print("[yellow]Warning: you using Windows. Some features may not work properly\n")
67 |
68 | settings = Settings()
69 |
70 | sessions_storage = SessionsStorage(
71 | "sessions",
72 | settings.api_id,
73 | settings.api_hash
74 | )
75 |
76 | functions_storage = FunctionsStorage(
77 | "functions",
78 | sessions_storage,
79 | settings
80 | )
81 |
82 | console.print("[bold white]accounts count> %d[/]" % len(sessions_storage))
83 |
84 | for index, module in enumerate(functions_storage.functions):
85 | instance, doc = module
86 |
87 | console.print(
88 | "[bold white][{index}] {doc}[/]"
89 | .format(index=index + 1, doc=doc)
90 | )
91 |
92 | while True:
93 | console.print()
94 |
95 | try:
96 | choice = console.input(
97 | "[bold white]>> [/]"
98 | )
99 |
100 | while not choice.isdigit():
101 | choice = console.input(
102 | "[bold white]>> [/]"
103 | )
104 | except KeyboardInterrupt:
105 | console.print("[bold white]Bye![/]")
106 | break
107 |
108 | else:
109 | choice = int(choice) - 1
110 |
111 | try:
112 | functions_storage.execute(choice)
113 | except KeyboardInterrupt:
114 | pass
115 |
116 |
--------------------------------------------------------------------------------
/media/picture.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/json1c/telegram-raid-botnet/a82845a5c78351a66aef24804a284656ed25d2b6/media/picture.jpg
--------------------------------------------------------------------------------
/modules/generators/application.py:
--------------------------------------------------------------------------------
1 | import random
2 | from abc import ABC, abstractmethod
3 |
4 |
5 | class Application(ABC):
6 | api_id: int
7 | api_hash: str
8 |
9 | lang_pack: str
10 |
11 | def system_lang_code():
12 | return random.choice(["zh-hans", "cn", "en", "ru", "af", "sq", "cs", "pl"])
13 |
14 | @abstractmethod
15 | def app_version() -> str:
16 | raise NotImplementedError()
17 |
18 | @abstractmethod
19 | def device() -> str:
20 | raise NotImplementedError()
21 |
22 | @abstractmethod
23 | def sdk() -> str:
24 | raise NotImplementedError()
25 |
--------------------------------------------------------------------------------
/modules/generators/linux.py:
--------------------------------------------------------------------------------
1 | import random
2 |
3 | from .application import Application
4 |
5 |
6 | class LinuxAPI(Application):
7 | enviroments = ["GNOME", "MATE", "XFCE", "Cinnamon", "Unity", "ubuntu", "LXDE", "i3", "Openbox", "bspwm", "dwm", "KDE"]
8 | compositors = ["Wayland", "XWayland", "X11"]
9 | glibc_versions = ["2.32", "2.33", "2.34", "2.35"]
10 | app_versions = ["4.0.2 x64", "4.0.2", "3.7.3 x64", "3.6.1", "3.1.1 x64", "3.1.1"]
11 |
12 | lang_pack = "tdesktop"
13 |
14 | api_id = 2040
15 | api_hash = "b18441a1ff607e10a989891a5462e627"
16 |
17 | @staticmethod
18 | def app_version() -> str:
19 | return random.choice(LinuxAPI.app_versions)
20 |
21 | @staticmethod
22 | def device() -> str:
23 | return "PC 64bit"
24 |
25 | @staticmethod
26 | def sdk() -> str:
27 | enviroment = random.choice(LinuxAPI.enviroments)
28 | compositor = random.choice(LinuxAPI.compositors)
29 | glibc_version = random.choice(LinuxAPI.glibc_versions)
30 |
31 | return f"Linux {enviroment} {compositor} glibc {glibc_version}"
32 |
--------------------------------------------------------------------------------
/modules/generators/telegram_android.py:
--------------------------------------------------------------------------------
1 | import random
2 |
3 | from .application import Application
4 |
5 |
6 | class TelegramAppAPI(Application):
7 | device_models = ['Samsung GT-I5510M', 'Samsung GT-I5800L', 'Samsung SCH-I559', 'Samsung SCH-i559', 'Samsung Behold II', 'Samsung GT-I9260', 'Samsung SM-A710XZ', 'Samsung GT-B9120', 'Samsung SCH-R880', 'Samsung SCH-R720', 'Samsung SGH-S730M', 'Samsung SHV-E270L', 'Samsung SAMSUNG-SGH-I927', 'Samsung SGH-I927', 'Samsung SCH-I699I', 'Samsung Samsung Chromebook 3', 'Samsung Samsung Chromebook Plus', 'Samsung kevin', 'Samsung Samsung Chromebook Plus (V2)', 'Samsung nautilus', 'Samsung Samsung Chromebook Pro', 'Samsung caroline', 'Samsung SPH-D600', 'Samsung SAMSUNG-SGH-I857', 'Samsung SCH-I510', 'Samsung SM-G1600', 'Samsung SM-G1650', 'Samsung GT-I5500B', 'Samsung GT-I5500L', 'Samsung GT-I5500M', 'Samsung GT-I5503T', 'Samsung GT-I5510L', 'Samsung SGH-T759', 'Samsung EK-GC100', 'Samsung GT-B9062', 'Samsung YP-GI2', 'Samsung SHW-M100S', 'Samsung archer', 'Samsung SM-A716S', 'Samsung SM-A015A', 'Samsung SM-A015AZ', 'Samsung SM-A015F', 'Samsung SM-A015G', 'Samsung SM-A015M', 'Samsung SM-A015T1', 'Samsung SM-A015U', 'Samsung SM-A015U1', 'Samsung SM-A015V', 'Samsung SM-S111DL', 'Samsung SM-A013F', 'Samsung SM-A013G', 'Samsung SM-A013M', 'Samsung SM-A022F', 'Samsung SM-A022G', 'Samsung SM-A022M', 'Samsung SM-A025A', 'Samsung SM-A025AZ', 'Samsung SM-A025F', 'Samsung SM-A025G', 'Samsung SM-A025M', 'Samsung SM-A025U', 'Samsung SM-A025U1', 'Samsung SM-A025V', 'Samsung SM-A105F', 'Samsung SM-A105FN', 'Samsung SM-A105G', 'Samsung SM-A105M', 'Samsung SM-A105N', 'Samsung SM-A102U', 'Samsung SM-A102U1', 'Samsung SM-A102W', 'Samsung SM-S102DL', 'Samsung SM-A102N', 'Samsung SM-A107F', 'Samsung SM-A107M', 'Samsung SM-A115A', 'Samsung SM-A115AP', 'Samsung SM-A115AZ', 'Samsung SM-A115F', 'Samsung SM-A115M', 'Samsung SM-A115U', 'Samsung SM-A115U1', 'Samsung SM-A115W', 'Samsung SM-A125F', 'Samsung SM-A125M', 'Samsung SM-A125N', 'Samsung SM-A125U', 'Samsung SM-A125U1', 'Samsung SM-S127DL', 'Samsung SM-A260F', 'Samsung SM-A260G', 'Samsung SC-02M', 'Samsung SCV46', 'Samsung SCV46-j', 'Samsung SCV46-u', 'Samsung SM-A205F', 'Samsung SM-A205FN', 'Samsung SM-A205G', 'Samsung SM-A205GN', 'Samsung SM-A205W', 'Samsung SM-A205YN', 'Samsung SM-A205U', 'Samsung SM-A205U1', 'Samsung SM-S205DL', 'Samsung SM-A202F', 'Samsung SM-A2070', 'Samsung SM-A207F', 'Samsung SM-A207M', 'Samsung SC-42A', 'Samsung SCV49', 'Samsung SM-A215U', 'Samsung SM-A215U1', 'Samsung SM-A215W', 'Samsung SM-S215DL', 'Samsung SM-A217F', 'Samsung SM-A217M', 'Samsung SM-A217N', 'Samsung SM-A226B', 'Samsung SM-A226B', 'Samsung SM-A300H', 'Samsung SM-A300F', 'Samsung SM-A300M', 'Samsung SM-A300XZ', 'Samsung SM-A300YZ', 'Samsung SM-A3000', 'Samsung SM-A300X', 'Samsung SM-A3009', 'Samsung SM-A300G', 'Samsung SM-A300F', 'Samsung SM-A3000', 'Samsung SM-A300YZ', 'Samsung SM-A300FU', 'Samsung SM-A300XU', 'Samsung SM-A300Y', 'Samsung SM-A320Y', 'Samsung SM-A013G', 'Samsung SM-A310F', 'Samsung SM-A310M', 'Samsung SM-A310X', 'Samsung SM-A310Y', 'Samsung SM-A310N0', 'Samsung SM-A320F', 'Samsung SM-A320FL', 'Samsung SM-A320X', 'Samsung SCV43', 'Samsung SCV43-j', 'Samsung SCV43-u', 'Samsung SM-A305F', 'Samsung SM-A305FN', 'Samsung SM-A305G', 'Samsung SM-A305GN', 'Samsung SM-A305GT', 'Samsung SM-A305N', 'Samsung SM-A305YN', 'Samsung SM-A307FN', 'Samsung SM-A307G', 'Samsung SM-A307GN', 'Samsung SM-A307GT', 'Samsung SM-A315F', 'Samsung SM-A315G', 'Samsung SM-A315N', 'Samsung SM-A325F', 'Samsung SM-A325M', 'Samsung SCG08', 'Samsung SM-A326B', 'Samsung SM-A326BR', 'Samsung SM-A326U', 'Samsung SM-A326U1', 'Samsung SM-A326W', 'Samsung SM-S326DL', 'Samsung SM-A405FM', 'Samsung SM-A405FN', 'Samsung SM-A405S', 'Samsung SM-A3050', 'Samsung SM-A3051', 'Samsung SM-A3058', 'Samsung SC-41A', 'Samsung SCV48', 'Samsung SM-A415F', 'Samsung SM-A4260', 'Samsung SM-A426B', 'Samsung SM-A426N', 'Samsung SM-A426U', 'Samsung SM-A426U1', 'Samsung SM-A500H', 'Samsung SM-A500F', 'Samsung SM-A500G', 'Samsung SM-A500M', 'Samsung SM-A500XZ', 'Samsung SM-A5000', 'Samsung SM-A500X', 'Samsung SM-A5009', 'Samsung SM-A5000', 'Samsung SM-A500YZ', 'Samsung SM-A500FU', 'Samsung SM-A500Y', 'Samsung SM-A500W', 'Samsung SM-A500K', 'Samsung SM-A500L', 'Samsung SM-A500F1', 'Samsung SM-A500S', 'Samsung SM-A510Y', 'Samsung SM-A510F', 'Samsung SM-A510M', 'Samsung SM-A510X', 'Samsung SM-A510Y', 'Samsung SM-A5108', 'Samsung SM-A510K', 'Samsung SM-A510L', 'Samsung SM-A510S', 'Samsung SM-A510Y', 'Samsung SM-A5100', 'Samsung SM-A5100X', 'Samsung SM-A510XZ', 'Samsung SM-A520F', 'Samsung SM-A520X', 'Samsung SM-A520W', 'Samsung SM-A520K', 'Samsung SM-A520L', 'Samsung SM-A520S', 'Samsung SM-A505F', 'Samsung SM-A505FM', 'Samsung SM-A505FN', 'Samsung SM-A505G', 'Samsung SM-A505GN', 'Samsung SM-A505GT', 'Samsung SM-A505N', 'Samsung SM-A505U', 'Samsung SM-A505U1', 'Samsung SM-A505W', 'Samsung SM-A505YN', 'Samsung SM-S506DL', 'Samsung SM-A5070', 'Samsung SM-A507FN', 'Samsung SM-A515F', 'Samsung SM-A515U', 'Samsung SM-A515U1', 'Samsung SM-A515W', 'Samsung SM-S515DL', 'Samsung SC-54A', 'Samsung SCG07', 'Samsung SM-A5160', 'Samsung SM-A516B', 'Samsung SM-A516N', 'Samsung SM-A516U', 'Samsung SM-A516U1', 'Samsung SM-A516V', 'Samsung SM-A525F', 'Samsung SM-A5260', 'Samsung SM-A526B', 'Samsung SM-A526N', 'Samsung SM-A526U', 'Samsung SM-A526U1', 'Samsung SM-A526W', 'Samsung SM-A600AZ', 'Samsung SM-A600A', 'Samsung SM-A600T1', 'Samsung SM-A600P', 'Samsung SM-A600T', 'Samsung SM-A600U', 'Samsung SM-A600F', 'Samsung SM-A600FN', 'Samsung SM-A600G', 'Samsung SM-A600GN', 'Samsung SM-A600N', 'Samsung SM-A605F', 'Samsung SM-A605FN', 'Samsung SM-A605G', 'Samsung SM-A605GN', 'Samsung SM-A6050', 'Samsung SM-A6060', 'Samsung SM-A606Y']
8 | sdk_versions = ["11 R? (30)", "10 Q (29)", "9 P (28)", "8 O (27)"]
9 | app_versions = ["8.8.3", "8.8.4", "8.8.5"]
10 |
11 | lang_pack = "android"
12 |
13 | api_id = 6
14 | api_hash = "eb06d4abfb49dc3eeb1aeb98ae0f581e"
15 |
16 | @staticmethod
17 | def app_version() -> str:
18 | return random.choice(TelegramAppAPI.app_versions)
19 |
20 | @staticmethod
21 | def device() -> str:
22 | return random.choice(TelegramAppAPI.device_models)
23 |
24 | @staticmethod
25 | def sdk() -> str:
26 | return random.choice(TelegramAppAPI.sdk_versions)
27 |
--------------------------------------------------------------------------------
/modules/settings.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 |
15 | import os
16 | import sys
17 | import toml
18 | from rich.console import Console
19 | from typing import List, Tuple
20 |
21 | console = Console()
22 |
23 |
24 | class Settings:
25 | def __init__(self):
26 | if not os.path.exists("config.toml"):
27 | self.initial_setup()
28 | sys.exit()
29 |
30 | with open("config.toml") as file:
31 | config = toml.load(file)
32 |
33 | self.api_id: int = config["sessions"]["api_id"]
34 | self.api_hash: str = config["sessions"]["api_hash"]
35 | self.messages: List[str] = config["flood"]["messages"]
36 | self.messages_count: int = config["flood"]["messages_count"]
37 | self.trigger: str = config["flood"]["trigger"]
38 | self.delay: List[int] = config["flood"]["delay"]
39 |
40 | def save(
41 | self,
42 | api_id: int,
43 | api_hash: str,
44 | messages: List[str],
45 | delay: List[int],
46 | messages_count: int,
47 | trigger: str
48 | ):
49 | config = dict(
50 | sessions=dict(
51 | api_hash=api_hash,
52 | api_id=api_id
53 | ),
54 | flood=dict(
55 | messages=messages,
56 | delay=delay,
57 | messages_count=messages_count,
58 | trigger=trigger
59 | )
60 | )
61 |
62 | with open("config.toml", "w") as file:
63 | toml.dump(config, file)
64 |
65 | def initial_setup(self):
66 | console.print(
67 | "[bold yellow]Initial setup[/]",
68 | justify="center"
69 | )
70 |
71 | print()
72 |
73 | console.print(
74 | "[bold blue]Sessions[/]",
75 | justify="center"
76 | )
77 |
78 | print()
79 | api_id, api_hash = self.setup_sessions()
80 |
81 | console.print(
82 | "[bold blue]Flood[/]",
83 | justify="center"
84 | )
85 |
86 | print()
87 | messages, delay, trigger = self.setup_flood()
88 |
89 | self.save(
90 | api_id,
91 | api_hash,
92 | messages,
93 | delay,
94 | 0,
95 | trigger
96 | )
97 |
98 | def setup_sessions(self) -> Tuple[int, str]:
99 | api_id = console.input("[bold white]Enter API ID: [/]")
100 | api_hash = console.input("[bold white]Enter API hash: [/]")
101 |
102 | return int(api_id), api_hash
103 |
104 | def setup_flood(self) -> Tuple[List[str], List[int], str]:
105 | console.print("[bold white]Enter messages[/]")
106 |
107 | messages = []
108 |
109 | while message := console.input("[bold white]>> [/]"):
110 | messages.append(message)
111 |
112 | print()
113 |
114 | delay = console.input("[bold white]Flooding delay (e.g. 1-3): [/]")
115 | delay = delay.split("-")
116 | delay = [int(x) for x in delay]
117 |
118 | trigger = console.input("[bold white]Enter the text after which bots will start flooding: [/]")
119 |
120 | return messages, delay, trigger
121 |
122 |
123 |
--------------------------------------------------------------------------------
/modules/storages/functions_storage.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 | import asyncio
15 | import importlib.util
16 | import inspect
17 | import os
18 |
19 | from typing import List, Callable, Awaitable, Union
20 |
21 | from .sessions_storage import SessionsStorage
22 | from ..settings import Settings
23 |
24 | class FunctionsStorage:
25 | def __init__(
26 | self,
27 | directory: str,
28 | sessions_storage: SessionsStorage,
29 | settings: Settings
30 | ):
31 | self.storage = sessions_storage
32 | self.settings = settings
33 |
34 | self.functions: List[Union[Callable, Awaitable]] = []
35 |
36 | for file in os.listdir(directory):
37 | if file.endswith(".py"):
38 | self.load_function(
39 | file[:-3], os.path.join(directory, file)
40 | )
41 |
42 | self.functions.sort(key=lambda item: item[1].lower())
43 |
44 | def load_function(self, name: str, path: str):
45 | spec = importlib.util.spec_from_file_location(name, path)
46 | function = importlib.util.module_from_spec(spec)
47 | spec.loader.exec_module(function)
48 |
49 | self.register_function(function)
50 |
51 | def register_function(self, module):
52 | for classname, classobj in inspect.getmembers(module, inspect.isclass):
53 | if classname.endswith("Func"):
54 | self.functions.append((
55 | classobj(self.storage, self.settings),
56 | classobj.__doc__
57 | ))
58 |
59 | def execute(self, index: int):
60 | try:
61 | function_instance = self.functions[index][0]
62 | except Exception:
63 | return
64 |
65 | function = function_instance.execute()
66 |
67 | if inspect.isawaitable(function):
68 | asyncio.get_event_loop().run_until_complete(function)
69 |
--------------------------------------------------------------------------------
/modules/storages/sessions_storage.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 |
15 | import asyncio
16 | import json
17 | import os
18 | from contextlib import asynccontextmanager, contextmanager
19 | from typing import Dict, List, Union
20 |
21 | from rich.console import Console
22 | from telethon.sessions import StringSession
23 | from telethon.sync import TelegramClient
24 |
25 | from modules.types.json_session import JsonSession
26 |
27 | console = Console()
28 |
29 |
30 | class SessionsStorage:
31 | def __init__(self, directory: str, api_id: Union[str, int], api_hash: str):
32 | self.full_sessions: Dict[str, Union[TelegramClient, JsonSession]] = {}
33 | self.json_sessions: List[JsonSession] = []
34 | self.jsessions_paths: Dict[str, JsonSession] = {}
35 |
36 | self.initialize = True if input("Initialize sessions? (y/n) ") == "y" else False
37 |
38 | for file in os.listdir(directory):
39 | if file.endswith(".session"):
40 | session_path = os.path.join(directory, file)
41 |
42 | with open(session_path) as fileobj:
43 | auth_key = fileobj.read()
44 |
45 | if len(auth_key) != 353:
46 | continue
47 |
48 | client = TelegramClient(
49 | StringSession(auth_key),
50 | api_id,
51 | api_hash,
52 | device_model="Redmi Note 10",
53 | lang_code="en",
54 | system_lang_code="en",
55 | )
56 |
57 | self.full_sessions[session_path] = client
58 |
59 | elif file.endswith(".jsession"):
60 | session_path = os.path.join(directory, file)
61 |
62 | with open(session_path) as fileobj:
63 | session_settings = json.load(fileobj)
64 |
65 | session = JsonSession(dict_settings=session_settings)
66 |
67 | if old_session := self.is_phone_exists(
68 | session.account.account.phone_number
69 | ):
70 | old_session_path = self.get_json_session_path(old_session)
71 |
72 | console.print(
73 | f"[bold yellow]WARNING:[/] Same accounts in botnet — {old_session_path} matches with {session_path}"
74 | )
75 |
76 | continue
77 |
78 | client = TelegramClient(
79 | session=StringSession(session.account.auth_key),
80 | api_id=session.account.application.api_id,
81 | api_hash=session.account.application.api_hash,
82 | device_model=session.account.application.device_name,
83 | app_version=session.account.application.app_version,
84 | system_version=session.account.application.sdk,
85 | lang_code=session.account.application.system_lang_code,
86 | system_lang_code=session.account.application.system_lang_code,
87 | proxy=session.account.proxy.as_telethon()
88 | if session.account.proxy else None,
89 | )
90 |
91 | self.full_sessions[session_path] = client
92 | self.json_sessions.append(session)
93 | self.jsessions_paths[session_path] = session
94 |
95 | if self.initialize:
96 | if len(self.full_sessions) == 0:
97 | return print(
98 | "In order for the botnet to work, you need to add accounts"
99 | )
100 |
101 | with console.status("Initializing..."):
102 | asyncio.get_event_loop().run_until_complete(
103 | asyncio.gather(
104 | *[
105 | self.check_session(session, path)
106 | for path, session in self.full_sessions.items()
107 | ]
108 | )
109 | )
110 |
111 | async def check_session(self, session: TelegramClient, path: str):
112 | console.log(f"Initializing session {path}")
113 |
114 | try:
115 | await session.connect()
116 | except ConnectionError:
117 | json_session = self.jsessions_paths.get("path")
118 |
119 | if json_session is not None:
120 | if json_session.account.proxy is not None:
121 | return console.log(
122 | f"Error with connection to session {path}. Maybe proxy {json_session.account.proxy.ip} is dead?"
123 | )
124 |
125 | console.log(f"Error with connection to session {path}")
126 |
127 | except Exception as err:
128 | console.log(f"Session {path} returned error. {err}. Removing.")
129 | del self.full_sessions[path]
130 | os.remove(path)
131 | return
132 |
133 | if not await session.is_user_authorized():
134 | console.log(f"Session {path} is dead. Removing it")
135 | del self.full_sessions[path]
136 | os.remove(path)
137 | return
138 |
139 | console.log(f"Initialized {path}")
140 |
141 | def get_session_path(self, session: TelegramClient | JsonSession) -> str:
142 | for path, client in self.full_sessions.items():
143 | if client == session:
144 | return path
145 |
146 | def get_json_session_path(self, json_session_: TelegramClient | JsonSession) -> str:
147 | for path, json_session in self.jsessions_paths.items():
148 | if json_session == json_session_:
149 | return path
150 |
151 | def is_phone_exists(self, phone: int) -> bool | JsonSession:
152 | for session in self.json_sessions:
153 | if session.account.account.phone_number == phone:
154 | return session
155 |
156 | return False
157 |
158 | @property
159 | def sessions(self) -> List[TelegramClient]:
160 | return list(self.full_sessions.values())
161 |
162 | @contextmanager
163 | def initialize_session(self, session):
164 | if not self.initialize:
165 | session.connect()
166 |
167 | yield
168 |
169 | if not self.initialize:
170 | session.disconnect()
171 |
172 | @asynccontextmanager
173 | async def ainitialize_session(self, session):
174 | if not self.initialize:
175 | await session.connect()
176 |
177 | yield
178 |
179 | if not self.initialize:
180 | await session.disconnect()
181 |
182 | def __len__(self):
183 | return len(self.sessions)
184 |
--------------------------------------------------------------------------------
/modules/types/account.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 | from dataclasses import dataclass
15 | from datetime import datetime
16 |
17 |
18 | @dataclass
19 | class Account:
20 | first_name: str
21 | last_name: str
22 | user_id: int
23 | added_at: datetime
24 | phone_number: str
25 |
26 |
--------------------------------------------------------------------------------
/modules/types/account_settings.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 | from dataclasses import dataclass
15 |
16 | from modules.types.account import Account
17 | from modules.types.application import Application
18 | from modules.types.proxy import Proxy
19 |
20 |
21 | @dataclass
22 | class AccountSettings:
23 | auth_key: str
24 |
25 | account: Account
26 | application: Application
27 | proxy: Proxy | None
28 |
29 | @staticmethod
30 | def from_dict(session_dict: dict) -> "AccountSettings":
31 | proxy = session_dict.get("proxy")
32 |
33 | return AccountSettings(
34 | auth_key=session_dict["auth_key"],
35 | account=Account(**session_dict["account"]),
36 | application=Application(**session_dict["application"]),
37 | proxy=Proxy(**proxy) if proxy else None
38 | )
39 |
--------------------------------------------------------------------------------
/modules/types/application.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 | from dataclasses import dataclass
15 |
16 |
17 | @dataclass
18 | class Application:
19 | api_id: int
20 | api_hash: str
21 |
22 | device_name: str
23 | app_version: str | int
24 | sdk: str
25 | lang_pack: str
26 | system_lang_code: str
27 |
--------------------------------------------------------------------------------
/modules/types/json_session.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 | import dataclasses
15 | import json
16 | import random
17 | from datetime import datetime
18 | from typing import Any
19 |
20 | from telethon import TelegramClient
21 | from telethon.sessions import StringSession
22 |
23 | from modules.generators.application import Application
24 | from modules.generators.linux import LinuxAPI
25 | from modules.generators.telegram_android import TelegramAppAPI
26 | from modules.types.account import Account
27 | from modules.types.account_settings import AccountSettings
28 | from modules.types.application import Application
29 | from modules.types.proxy import Proxy
30 |
31 |
32 | class JsonSession:
33 | def __init__(self, *, account_settings=None, dict_settings=None):
34 | if account_settings is not None:
35 | self.account: AccountSettings = account_settings
36 |
37 | elif dict_settings is not None:
38 | self.account: AccountSettings = AccountSettings.from_dict(dict_settings)
39 |
40 | def save(self, filename):
41 | with open(filename, "w") as file:
42 | json.dump(
43 | dataclasses.asdict(self.account), file, indent=4, ensure_ascii=False
44 | )
45 |
46 | @staticmethod
47 | async def create_application_session(
48 | generator: Application | Any = None,
49 | proxy: Proxy | Any = None,
50 | api_hash: str | Any = None,
51 | api_id: str | Any = None,
52 | device_name: str | Any = None,
53 | app_version: str | Any = None,
54 | sdk: str | Any = None,
55 | ):
56 | if not generator:
57 | generator = random.choice([LinuxAPI, TelegramAppAPI])
58 |
59 | api_hash = api_hash or generator.api_hash
60 | api_id = api_id or generator.api_id
61 | app_version = app_version or generator.app_version()
62 | device_name = device_name or generator.device()
63 | sdk = sdk or generator.sdk()
64 | lang_pack = generator.lang_pack
65 | system_lang_code = generator.system_lang_code()
66 |
67 | async with TelegramClient(
68 | session=StringSession(),
69 | api_id=api_id,
70 | api_hash=api_hash,
71 | device_model=device_name,
72 | app_version=app_version,
73 | system_version=sdk,
74 | lang_code=system_lang_code,
75 | system_lang_code=system_lang_code,
76 | proxy=proxy.as_telethon() if proxy else None
77 | ) as client:
78 | account = await client.get_me()
79 |
80 | account_settings = AccountSettings(
81 | auth_key=client.session.save(),
82 | account=Account(
83 | first_name=account.first_name,
84 | last_name=account.last_name,
85 | user_id=account.id,
86 | added_at=datetime.now().timestamp(),
87 | phone_number=account.phone,
88 | ),
89 | application=Application(
90 | api_id=api_id,
91 | api_hash=api_hash,
92 | device_name=device_name,
93 | app_version=app_version,
94 | sdk=sdk,
95 | lang_pack=lang_pack,
96 | system_lang_code=system_lang_code,
97 | ),
98 | proxy=proxy
99 | )
100 |
101 | with open(f"{account.phone}.jsession", "w") as file:
102 | json.dump(
103 | dataclasses.asdict(account_settings),
104 | file,
105 | ensure_ascii=True,
106 | indent=4
107 | )
108 |
109 | @staticmethod
110 | async def build_session_from_telegram_client(
111 | client: TelegramClient,
112 | generator: Application | Any = None,
113 | api_hash: str | Any = None,
114 | api_id: str | Any = None,
115 | device_name: str | Any = None,
116 | app_version: str | Any = None,
117 | sdk: str | Any = None,
118 | lang_pack: str | Any = None,
119 | system_lang_code: str | Any = None,
120 | proxy: Proxy | Any = None
121 | ) -> "JsonSession":
122 | account = await client.get_me()
123 |
124 | if not generator:
125 | generator = random.choice([LinuxAPI, TelegramAppAPI])
126 |
127 | api_hash = api_hash or generator.api_hash
128 | api_id = api_id or generator.api_id
129 | app_version = app_version or generator.app_version()
130 | device_name = device_name or generator.device()
131 | sdk = sdk or generator.sdk()
132 | lang_pack = generator.lang_pack
133 | system_lang_code = system_lang_code or generator.system_lang_code()
134 |
135 | return JsonSession(
136 | account_settings=AccountSettings(
137 | auth_key=client.session.save(),
138 | account=Account(
139 | first_name=account.first_name,
140 | last_name=account.last_name,
141 | user_id=account.id,
142 | added_at=datetime.now().timestamp(),
143 | phone_number=account.phone,
144 | ),
145 | application=Application(
146 | api_id=api_id,
147 | api_hash=api_hash,
148 | device_name=device_name,
149 | app_version=app_version,
150 | sdk=sdk,
151 | lang_pack=lang_pack,
152 | system_lang_code=system_lang_code,
153 | ),
154 | proxy=proxy
155 | )
156 | )
157 |
--------------------------------------------------------------------------------
/modules/types/proxy.py:
--------------------------------------------------------------------------------
1 | from dataclasses import dataclass, field
2 |
3 |
4 | @dataclass
5 | class Proxy:
6 | proxy_type: str # socks4, socks5, http
7 | ip: str
8 | port: int
9 | user: str
10 | password: str
11 |
12 | def __init__(
13 | self,
14 | proxy_type: str,
15 | ip: str,
16 | port: int,
17 | user: str = None,
18 | password: str = None,
19 | ):
20 | self.proxy_type = proxy_type
21 | self.ip = ip
22 | self.port = port
23 | self.user = user
24 | self.password = password
25 |
26 | def as_telethon(self) -> tuple:
27 | if self.user and self.password:
28 | return (
29 | self.proxy_type,
30 | self.ip,
31 | self.port,
32 | False,
33 | self.user,
34 | self.password,
35 | )
36 |
37 | return (self.proxy_type, self.ip, self.port)
38 |
--------------------------------------------------------------------------------
/modules/updater.py:
--------------------------------------------------------------------------------
1 | # https://github.com/json1c
2 | # Copyright (C) 2023 json1c
3 |
4 | # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
5 | # as published by the Free Software Foundation, either version 3 of the License
6 |
7 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 | # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 | # See the GNU General Public License for more details.
10 |
11 | # You should have received a copy of the GNU General Public License along with this program.
12 | # If not, see .
13 |
14 | import git
15 | import typing
16 | import os
17 | import atexit
18 | import sys
19 | import subprocess
20 |
21 | from git.exc import GitCommandError
22 | from git import Repo
23 |
24 |
25 | def get_current_commit() -> typing.Union[bool, str]:
26 | """Get current commit"""
27 |
28 | try:
29 | repo = git.Repo()
30 | return repo.heads[0].commit.hexsha
31 | except Exception:
32 | return False
33 |
34 |
35 | def check_update() -> bool:
36 | """Check update for botnet"""
37 |
38 | try:
39 | repo = git.Repo(os.getcwd())
40 | except git.exc.GitError:
41 | repo = Repo.init(os.getcwd())
42 | origin = repo.create_remote("origin", "https://github.com/json1c/telegram-raid-botnet")
43 | origin.fetch()
44 | repo.create_head("master", origin.refs.master)
45 | repo.heads.master.set_tracking_branch(origin.refs.master)
46 | repo.heads.master.checkout(True)
47 |
48 | try:
49 | upcoming_commit = git.Remote(repo, "origin").fetch()[0].commit
50 | except GitCommandError as err:
51 | if "detected dubious ownership" in err.stderr:
52 | os.system(f"git config --global --add safe.directory {os.getcwd()}")
53 | return check_update()
54 |
55 | else:
56 | print(f"Error: {err}")
57 | exit(1)
58 |
59 | current_commit = get_current_commit()
60 |
61 | if current_commit == upcoming_commit.hexsha:
62 | return {"has_update": False}
63 |
64 | return {
65 | "has_update": True,
66 | "current_commit": current_commit,
67 | "upcoming_commit": upcoming_commit.hexsha,
68 | "message": upcoming_commit.message
69 | }
70 |
71 |
72 | def update_requirements(console):
73 | with console.status("Installing new requirements..."):
74 | subprocess.run(
75 | [
76 | sys.executable,
77 | "-m",
78 | "pip",
79 | "install",
80 | "-r",
81 | os.path.join(
82 | os.getcwd(),
83 | "requirements.txt",
84 | ),
85 | "--user",
86 | ],
87 | check=True,
88 | )
89 |
90 | console.print("[bold green]New requirements installed successfully.")
91 |
92 |
93 | def on_exit():
94 | os.execl(
95 | sys.executable,
96 | sys.executable,
97 | *sys.argv
98 | )
99 |
100 |
101 | def restart_botnet():
102 | atexit.register(on_exit)
103 | exit(0)
104 |
105 |
106 | def update(console):
107 | try:
108 | with console.status("Updating..."):
109 | repo = Repo(os.getcwd())
110 | origin = repo.remote("origin")
111 | r = origin.pull()
112 |
113 | console.print("[bold green]Updated successfully!")
114 |
115 | new_commit = repo.head.commit
116 |
117 | for info in r:
118 | for d in new_commit.diff(info.old_commit):
119 | if d.b_path == "requirements.txt":
120 | update_requirements(console)
121 |
122 | restart_botnet()
123 | except git.exc.InvalidGitRepositoryError:
124 | repo = Repo.init(os.getcwd())
125 | origin = repo.create_remote("origin", "https://github.com/json1c/telegram-raid-botnet")
126 | origin.fetch()
127 | repo.create_head("master", origin.refs.master)
128 | repo.heads.master.set_tracking_branch(origin.refs.master)
129 | repo.heads.master.checkout(True)
130 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | telethon
2 | toml
3 | rich
4 | youtube-dl
5 | py-tgcalls
6 | ffmpeg-python
7 | gitpython
8 | phonenumbers
9 | pyrogram
10 | tgcrypto
11 | python-socks[asyncio]
--------------------------------------------------------------------------------
/sessions/add_session.py:
--------------------------------------------------------------------------------
1 | import sys
2 |
3 | sys.path.append("..")
4 |
5 | import asyncio
6 |
7 | from modules.generators.linux import LinuxAPI
8 | from modules.generators.telegram_android import TelegramAppAPI
9 | from modules.types.json_session import JsonSession
10 | from modules.types.proxy import Proxy
11 |
12 | generators = {
13 | "1": TelegramAppAPI,
14 | "2": LinuxAPI,
15 | "3": None
16 | }
17 |
18 | proxy_types = {
19 | "1": "socks4",
20 | "2": "socks5",
21 | "3": "http",
22 | "4": None
23 | }
24 |
25 |
26 | print("[1] - Telegram Android")
27 | print("[2] - Telegram Desktop (Linux)")
28 | print("[3] - Random")
29 |
30 | genetator_choice = input(">> ")
31 | generator = generators[genetator_choice]
32 |
33 | print("Proxy:")
34 | print("[1] - Socks4")
35 | print("[2] - Socks5")
36 | print("[3] - HTTP")
37 | print("[4] - Not use proxy")
38 |
39 | proxy_type_choice = input(">> ")
40 | proxy_type = proxy_types[proxy_type_choice]
41 |
42 | proxy = None
43 |
44 | if proxy_type is not None:
45 | proxy_ip = input("Proxy IP: ")
46 | proxy_port = int(input("Proxy port: "))
47 | proxy_user = input("Proxy user (leave blank if not exists): ")
48 | proxy_password = input("Proxy password (leave blank if not exists): ")
49 |
50 | proxy = Proxy(proxy_type, proxy_ip, proxy_port, proxy_user, proxy_password)
51 |
52 | asyncio.run(
53 | JsonSession().create_application_session(generator, proxy)
54 | )
55 |
56 |
--------------------------------------------------------------------------------
/sessions/login.py:
--------------------------------------------------------------------------------
1 | import json
2 | import sys
3 |
4 | sys.path.append("..")
5 |
6 | from telethon import events
7 | from telethon.sessions.string import StringSession
8 | from telethon.sync import TelegramClient
9 |
10 | from modules.types.json_session import JsonSession
11 |
12 | if len(sys.argv) != 2:
13 | print("Usage: python login.py ")
14 | sys.exit(1)
15 |
16 | name = sys.argv[1]
17 |
18 | with open(name) as fileobj:
19 | session_settings = json.load(fileobj)
20 |
21 | session = JsonSession(dict_settings=session_settings)
22 |
23 | client = TelegramClient(
24 | session=StringSession(session.account.auth_key),
25 | api_id=session.account.application.api_id,
26 | api_hash=session.account.application.api_hash,
27 | device_model=session.account.application.device_name,
28 | app_version=session.account.application.app_version,
29 | system_version=session.account.application.sdk,
30 | lang_code=session.account.application.system_lang_code,
31 | system_lang_code=session.account.application.system_lang_code,
32 | proxy=session.account.proxy.as_telethon()
33 | if session.account.proxy else None,
34 | )
35 |
36 | with client:
37 | print("Mobile phone:", client.get_me().phone)
38 |
39 |
40 | @client.on(events.NewMessage)
41 | async def handler(msg):
42 | if msg.from_id.user_id == 777000:
43 | print(msg.text)
44 |
45 | client.start()
46 | client.run_until_disconnected()
47 |
--------------------------------------------------------------------------------