├── .github
└── FUNDING.yml
├── LICENSE
├── README.md
├── app
├── build.gradle
├── dist
│ └── k3pler_v1-3.apk
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── k3
│ │ └── k3pler
│ │ ├── adapter
│ │ ├── BlacklistAdapter.java
│ │ ├── LayoutPagerAdapter.java
│ │ └── RequestAdapter.java
│ │ ├── frag
│ │ ├── AboutPageInflater.java
│ │ ├── BlacklistPageInflater.java
│ │ ├── MainPageInflater.java
│ │ └── SettingsPageInflater.java
│ │ ├── handler
│ │ ├── LProxy.java
│ │ ├── NotificationHandler.java
│ │ ├── RequestDialog.java
│ │ ├── ServiceController.java
│ │ └── SqliteDBHelper.java
│ │ ├── sub
│ │ ├── FilteredResponse.java
│ │ ├── HTTPReq.java
│ │ ├── ProxyNotifier.java
│ │ ├── SQLiteBL.java
│ │ ├── SQLiteSettings.java
│ │ └── TextViewEFX.java
│ │ └── ui
│ │ ├── MainActivity.java
│ │ └── ProxyService.java
│ └── res
│ ├── drawable
│ ├── k3pler_logo.png
│ ├── k3plerbg3.png
│ └── k3plerlogo2.png
│ ├── layout
│ ├── layout_main.xml
│ ├── layout_pager_about.xml
│ ├── layout_pager_blacklist.xml
│ ├── layout_pager_main.xml
│ ├── layout_pager_settings.xml
│ ├── layout_req_detail.xml
│ ├── layout_splash.xml
│ ├── list_blacklist.xml
│ └── list_requests.xml
│ ├── mipmap-hdpi
│ └── k3pler_logo.png
│ ├── mipmap-mdpi
│ └── k3pler_logo.png
│ ├── mipmap-xhdpi
│ └── k3pler_logo.png
│ ├── mipmap-xxhdpi
│ └── k3pler_logo.png
│ ├── mipmap-xxxhdpi
│ └── k3pler_logo.png
│ ├── values-tr
│ ├── strings.xml
│ └── styles.xml
│ ├── values-w820dp
│ └── dimens.xml
│ └── values
│ ├── colors.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
├── build.gradle
├── etc
├── k3pler_logo3.png
├── k3plerbg3_splash.png
├── page1.png
├── page2.png
└── page3.png
├── gradle.properties
├── gradle
└── wrapper
│ └── gradle-wrapper.properties
└── settings.gradle
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: orhun
2 | patreon: orhunp
3 |
--------------------------------------------------------------------------------
/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 | # k3pler
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | ### Android network connection blocker and packet analyzer built on top of local HTTP proxy.
11 |
12 | [
](https://play.google.com/store/apps/details?id=com.k3.k3pler)
15 |
16 |
17 |
18 | ## Features
19 | * Show network traffic in a list (HTTP Request/Response)
20 |
21 |
22 |
23 | * Gives details about requests/responses with abbreviations in list.
24 | (eg: ```example.com ~ C [H/1.1] _S_ {time}```)
25 | (C -> Connect | H/1.1 -> HTTP version | _S_ -> Success)
26 | * Blacklist connection after getting detailed information
27 | * Edit/Remove item at blacklist - clear blacklist
28 |
29 |
30 |
31 | * Settings:
32 | ```
33 | Proxy Port: Local Proxy port for connection
34 | Max. Buffer: Maximum response buffer size in bytes
35 | Match Type:
36 | Full: Block if request URI equals blacklist item
37 | Keyword: Block if request URI contains blacklist item
38 | Blacklist Response: Response status which will be sent to blocked address
39 | Splash Screen: Show splash screen when app starts
40 | ```
41 |
42 |
43 |
44 | * Shows instructions of configuring proxy (WIFI / Mobile Network)
45 |
46 | ## APK
47 |
48 | [Download APK](https://github.com/orhun/k3pler/raw/master/app/dist/k3pler_v1-3.apk)
49 |
50 | ## TODO(s)
51 |
52 | * [#5](https://github.com/orhun/k3pler/issues/5)
53 | * [#4](https://github.com/orhun/k3pler/issues/4)
54 | * Improve UI, support different devices
55 |
56 | ## Licenses
57 |
58 |
59 | • [GNU Public License v3](https://www.gnu.org/licenses/gpl.txt)
60 | • [Android v7 RecyclerView Library](https://developer.android.com/topic/libraries/support-library/packages) `(Apache 2.0)`
61 | • [LittleProxy 1.1.2](https://github.com/adamfisk/LittleProxy) `(Apache 2.0)`
62 |
63 | ## Copyright
64 |
65 | Copyright (c) 2018-2023, [orhun](https://www.github.com/orhun)
66 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 | buildToolsVersion "28.0.3"
6 | defaultConfig {
7 | applicationId "com.k3.k3pler"
8 | minSdkVersion 17
9 | targetSdkVersion 28
10 | versionCode 4
11 | versionName "1.3"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | implementation fileTree(include: ['*.jar'], dir: 'libs')
24 | androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 | implementation 'com.android.support:recyclerview-v7:28.0.0'
28 | implementation 'org.littleshoot:littleproxy:1.1.2'
29 | testImplementation 'junit:junit:4.12'
30 | }
31 |
--------------------------------------------------------------------------------
/app/dist/k3pler_v1-3.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/orhun/k3pler/6a2dcc7c45110d7428dd9597fce4aab4d6011801/app/dist/k3pler_v1-3.apk
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in C:\Users\Unknown\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
13 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/k3/k3pler/adapter/BlacklistAdapter.java:
--------------------------------------------------------------------------------
1 | package com.k3.k3pler.adapter;
2 |
3 |
4 | import android.content.Context;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.BaseAdapter;
9 | import android.widget.TextView;
10 | import com.k3.k3pler.R;
11 |
12 | import java.util.ArrayList;
13 |
14 | /** Adapter for recyclerView list [blacklist page] **/
15 | public class BlacklistAdapter extends BaseAdapter {
16 | private Context context;
17 | private ArrayList blackList;
18 | private LayoutInflater inflater;
19 |
20 | private TextView txvReqBlacklist;
21 |
22 | private void init(View view) {
23 | txvReqBlacklist = view.findViewById(R.id.txvReqBlacklist);
24 | }
25 |
26 | public BlacklistAdapter(Context context, ArrayList blackList){
27 | this.context = context;
28 | this.blackList = blackList;
29 | }
30 | @Override
31 | public int getCount(){
32 | return blackList.size();
33 | }
34 |
35 | @Override
36 | public Object getItem(int position){
37 | return blackList.get(position);
38 | }
39 |
40 | @Override
41 | public long getItemId(int position){
42 | return 0;
43 | }
44 | @Override
45 | public View getView(final int position, View conView, ViewGroup viewGroup){
46 | inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
47 | conView = inflater.inflate(R.layout.list_blacklist, viewGroup, false);
48 | init(conView);
49 | txvReqBlacklist.setText(blackList.get(position));
50 | return conView;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/java/com/k3/k3pler/adapter/LayoutPagerAdapter.java:
--------------------------------------------------------------------------------
1 | package com.k3.k3pler.adapter;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.NonNull;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | import com.k3.k3pler.R;
10 |
11 | import java.util.ArrayList;
12 |
13 | /** Layout inflater class for viewPager layouts **/
14 | public class LayoutPagerAdapter extends android.support.v4.view.PagerAdapter {
15 | public enum PagerEnum {
16 | MainPage(R.string.main_page, R.layout.layout_pager_main),
17 | BlackListPage(R.string.blacklist_page, R.layout.layout_pager_blacklist),
18 | SettingsPage(R.string.settings_page, R.layout.layout_pager_settings),
19 | AboutPage(R.string.about_page, R.layout.layout_pager_about);
20 | private int mTitleResId;
21 | private int mLayoutResId;
22 | PagerEnum(int titleResId, int layoutResId) {
23 | mTitleResId = titleResId;
24 | mLayoutResId = layoutResId;
25 | }
26 | public int getTitleResId() {
27 | return mTitleResId;
28 | }
29 | public int getLayoutResId() {
30 | return mLayoutResId;
31 | }
32 | }
33 | private Context context;
34 | private ArrayList layouts = new ArrayList<>();
35 | public interface IViewPager{
36 | void onViewsAdded(ArrayList layouts);
37 | }
38 | private IViewPager iViewPager;
39 |
40 | public LayoutPagerAdapter(Context context, IViewPager iViewPager) {
41 | this.context = context;
42 | this.iViewPager = iViewPager;
43 | }
44 |
45 | @Override
46 | public Object instantiateItem(@NonNull ViewGroup collection, int position) {
47 | PagerEnum pagerEnum = PagerEnum.values()[position];
48 | LayoutInflater inflater = LayoutInflater.from(context);
49 | ViewGroup layout = (ViewGroup) inflater.inflate(pagerEnum.getLayoutResId(),
50 | collection, false);
51 | layouts.add(layout);
52 | collection.addView(layout);
53 | if(position == getCount() - 1) {
54 | iViewPager.onViewsAdded(layouts);
55 | }
56 | return layout;
57 | }
58 | @Override
59 | public void destroyItem(@NonNull ViewGroup collection, int position,
60 | @NonNull Object view) {
61 | collection.removeView((View) view);
62 | }
63 |
64 | @Override
65 | public int getCount() {
66 | return PagerEnum.values().length;
67 | }
68 |
69 | @Override
70 | public boolean isViewFromObject(@NonNull View view, @NonNull Object object) {
71 | return view == object;
72 | }
73 |
74 | @Override
75 | public CharSequence getPageTitle(int position) {
76 | PagerEnum pagerEnum = PagerEnum.values()[position];
77 | return context.getString(pagerEnum.getTitleResId());
78 | }
79 |
80 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/k3/k3pler/adapter/RequestAdapter.java:
--------------------------------------------------------------------------------
1 | package com.k3.k3pler.adapter;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.NonNull;
5 | import android.support.v4.content.ContextCompat;
6 | import android.support.v7.widget.RecyclerView;
7 | import android.text.Html;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 | import android.widget.TextView;
12 |
13 | import com.k3.k3pler.R;
14 | import com.k3.k3pler.sub.HTTPReq;
15 |
16 | import java.util.ArrayList;
17 |
18 | import io.netty.handler.codec.DecoderResult;
19 |
20 | /** Adapter for recyclerView list [main page] **/
21 | public class RequestAdapter extends RecyclerView.Adapter {
22 | private Context context;
23 | public ArrayList requests;
24 | private int requestColor;
25 |
26 | public interface OnItemClickListener {
27 | void onItemClick(HTTPReq item, int i);
28 | }
29 | private OnItemClickListener onItemClickListener;
30 |
31 | public class ViewHolder extends RecyclerView.ViewHolder {
32 | private TextView txvRequest;
33 | public ViewHolder(View view) {
34 | super(view);
35 | txvRequest = view.findViewById(R.id.txvRequest);
36 | }
37 | public void bind(final HTTPReq item, final int i, final OnItemClickListener listener) {
38 | itemView.setOnClickListener(new View.OnClickListener() {
39 | @Override
40 | public void onClick(View v) {
41 | listener.onItemClick(item, i);
42 | }
43 | });
44 | }
45 | }
46 | public RequestAdapter(Context context, ArrayList requests, OnItemClickListener onItemClickListener) {
47 | this.context = context;
48 | this.requests = requests;
49 | this.onItemClickListener = onItemClickListener;
50 | }
51 | @Override
52 | public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
53 | View itemView = LayoutInflater.from(parent.getContext())
54 | .inflate(R.layout.list_requests, parent, false);
55 | return new ViewHolder(itemView);
56 | }
57 | @Override
58 | @SuppressWarnings("deprecation")
59 | public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
60 | if (requests.get(position).getBlocked())
61 | requestColor = ContextCompat.getColor(context, android.R.color.holo_red_dark);
62 | else
63 | requestColor = ContextCompat.getColor(context, android.R.color.white);
64 | String method = String.valueOf(requests.get(position).getMethod().charAt(0));
65 | String protocol = requests.get(position).getProtocol().replace("HTTP", "H");
66 | String decoderResult = getShortResult(requests.get(position).getResult());
67 | String htmlEntry = ""+
68 | ""
70 | + requests.get(position).getUri() + ""+""
72 | +" ~ "+""
74 | + method +""+""
76 | + " [" + protocol + "] " +""+""
78 | + "_" + decoderResult + "_ " +""+""
80 | + " " + requests.get(position).getTime() +""
81 | + "";
82 | holder.txvRequest.setText(Html.fromHtml(htmlEntry));
83 | holder.bind(requests.get(position), position, onItemClickListener);
84 | }
85 | @Override
86 | public int getItemCount() {
87 | return requests.size();
88 | }
89 |
90 | private String getShortResult(DecoderResult result){
91 | if (result.isSuccess())
92 | return "S";
93 | else if (result.isFinished())
94 | return "F";
95 | else if (result.isFailure())
96 | return "X";
97 | else
98 | return "-";
99 | }
100 | public static String getLongResult(DecoderResult result){
101 | return result.toString();
102 | }
103 |
104 |
105 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/k3/k3pler/frag/AboutPageInflater.java:
--------------------------------------------------------------------------------
1 | package com.k3.k3pler.frag;
2 |
3 |
4 | import android.app.Dialog;
5 | import android.content.Context;
6 | import android.content.Intent;
7 | import android.content.pm.PackageInfo;
8 | import android.content.pm.PackageManager;
9 | import android.net.Uri;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.TextView;
13 | import android.widget.Toast;
14 |
15 | import com.k3.k3pler.R;
16 |
17 | /** About page **/
18 | public class AboutPageInflater {
19 | private Context context;
20 | private ViewGroup viewGroup;
21 | private Dialog guiDialog;
22 | private static String version = "1.0",
23 | recyclerviewLicence = "https://developer.android.com/topic/libraries/support-library/packages",
24 | littleproxyProject = "https://github.com/adamfisk/LittleProxy";
25 | // ** //
26 | private TextView txvProjectInfo, txvLicenceRecycler,
27 | txvLicenceLittleProxy, txvJKepler;
28 | public AboutPageInflater(Context context, ViewGroup viewGroup, Dialog guiDialog){
29 | this.context = context;
30 | this.viewGroup = viewGroup;
31 | this.guiDialog = guiDialog;
32 | }
33 | public void init(){
34 | txvProjectInfo = viewGroup.findViewById(R.id.txvProjectInfo);
35 | txvLicenceRecycler = viewGroup.findViewById(R.id.txvLicenceRecycler);
36 | txvLicenceLittleProxy = viewGroup.findViewById(R.id.txvLicenceLittleProxy);
37 | txvJKepler = viewGroup.findViewById(R.id.txvJKepler);
38 | try {
39 | PackageManager manager = context.getPackageManager();
40 | PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0);
41 | version = info.versionName;
42 | }catch (Exception e){
43 | e.printStackTrace();
44 | }
45 | txvProjectInfo.setText(context.getString(R.string.main_page) + " v" + version);
46 | txvLicenceRecycler.setOnClickListener(new View.OnClickListener() {
47 | @Override
48 | public void onClick(View view) {
49 | openPage(recyclerviewLicence);
50 | }
51 | });
52 | txvLicenceLittleProxy.setOnClickListener(new View.OnClickListener() {
53 | @Override
54 | public void onClick(View view) {
55 | openPage(littleproxyProject);
56 | }
57 | });
58 | txvJKepler.setOnClickListener(new View.OnClickListener() {
59 | @Override
60 | public void onClick(View view) {
61 | openPage(context.getString(R.string.jkepler_link));
62 | }
63 | });
64 | }
65 | private void openPage(String url){
66 | try {
67 | Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
68 | intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
69 | context.startActivity(intent);
70 | dismissGuiDialog();
71 | }catch (Exception e){
72 | e.printStackTrace();
73 | }
74 | }
75 | private void dismissGuiDialog(){
76 | try {
77 | if(guiDialog != null && guiDialog.isShowing()) {
78 | guiDialog.dismiss();
79 | }
80 | }catch (Exception e){
81 | e.printStackTrace();
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/app/src/main/java/com/k3/k3pler/frag/BlacklistPageInflater.java:
--------------------------------------------------------------------------------
1 | package com.k3.k3pler.frag;
2 |
3 |
4 | import android.app.AlertDialog;
5 | import android.content.Context;
6 | import android.content.DialogInterface;
7 | import android.content.res.Resources;
8 | import android.os.Handler;
9 | import android.support.v4.widget.SwipeRefreshLayout;
10 | import android.text.InputType;
11 | import android.view.View;
12 | import android.view.ViewGroup;
13 | import android.view.WindowManager;
14 | import android.widget.AdapterView;
15 | import android.widget.EditText;
16 | import android.widget.LinearLayout;
17 | import android.widget.ListView;
18 | import android.widget.TextView;
19 |
20 | import com.k3.k3pler.R;
21 | import com.k3.k3pler.adapter.BlacklistAdapter;
22 | import com.k3.k3pler.handler.RequestDialog;
23 | import com.k3.k3pler.handler.SqliteDBHelper;
24 | import com.k3.k3pler.sub.SQLiteBL;
25 |
26 | import java.util.ArrayList;
27 |
28 | /** Blacklist page **/
29 | public class BlacklistPageInflater {
30 | private Context context;
31 | private ViewGroup viewGroup;
32 | private SqliteDBHelper sqliteDBHelper;
33 | private ArrayList blackListArr = new ArrayList<>();
34 | private BlacklistAdapter blacklistAdapter;
35 | // ** //
36 | private ListView lstBlacklist;
37 | private TextView txvBlacklistOptions, txvBlPageMsg;
38 | private SwipeRefreshLayout swpBlacklist;
39 |
40 | public BlacklistPageInflater(Context context, ViewGroup viewGroup){
41 | this.context = context;
42 | this.viewGroup = viewGroup;
43 | }
44 | public BlacklistPageInflater(Context context){
45 | this.context = context;
46 | }
47 | public void init(){
48 | lstBlacklist = viewGroup.findViewById(R.id.lstBlacklist);
49 | txvBlacklistOptions = viewGroup.findViewById(R.id.txvBlacklistOptions);
50 | txvBlacklistOptions.setOnClickListener(new View.OnClickListener() {
51 | @Override
52 | public void onClick(View view) {
53 | sqliteDBHelper = new SqliteDBHelper(context,
54 | new SQLiteBL(context).getWritableDatabase(),
55 | SQLiteBL.BLACKLIST_DATA, SQLiteBL.TABLE_NAME);
56 | sqliteDBHelper.deleteAll();
57 | sqliteDBHelper.close();
58 | setBlacklistLstView();
59 | }
60 | });
61 | txvBlPageMsg = viewGroup.findViewById(R.id.txvBlPageMsg);
62 | swpBlacklist = viewGroup.findViewById(R.id.swpBlacklist);
63 | swpBlacklist.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
64 | @Override
65 | public void onRefresh() {
66 | new Handler().postDelayed(new Runnable() {
67 | @Override
68 | public void run() {
69 | swpBlacklist.setRefreshing(false);
70 | setBlacklistLstView();
71 | }
72 | }, 1000);
73 | }
74 | });
75 | setBlacklistLstView();
76 | }
77 | public String getBlacklist(){
78 | String blackList = "";
79 | sqliteDBHelper = new SqliteDBHelper(context,
80 | new SQLiteBL(context).getWritableDatabase(),
81 | SQLiteBL.BLACKLIST_DATA, SQLiteBL.TABLE_NAME);
82 | blackList = sqliteDBHelper.getAll();
83 | sqliteDBHelper.close();
84 | return blackList;
85 | }
86 | @SuppressWarnings("deprecation")
87 | public void setBlacklistLstView() {
88 | String[] blackList = getBlacklist().split("["+SqliteDBHelper.SPLIT_CHAR+"]");
89 | blackListArr.clear();
90 | for (String item : blackList) {
91 | if (item.length() > 3) {
92 | blackListArr.add(item);
93 | }
94 | }
95 | blacklistAdapter = new BlacklistAdapter(context, blackListArr);
96 | lstBlacklist.setAdapter(blacklistAdapter);
97 | lstBlacklist.setOnItemClickListener(new AdapterView.OnItemClickListener() {
98 | @Override
99 | public void onItemClick(AdapterView> adapterView, View view, final int i, long l) {
100 | final String[] options = new String[]{context.getString(R.string.remove_blacklist),
101 | context.getString(R.string.edit_blaclist_item)};
102 | AlertDialog.Builder builder = new AlertDialog.Builder(context, android.R.style.Theme_DeviceDefault_Dialog);
103 | builder.setTitle(blackListArr.get(i));
104 | builder.setItems(options, new DialogInterface.OnClickListener() {
105 | @Override
106 | public void onClick(DialogInterface dialog, int which) {
107 | if (which == 0) {
108 | sqliteDBHelper = new SqliteDBHelper(context,
109 | new SQLiteBL(context).getWritableDatabase(),
110 | SQLiteBL.BLACKLIST_DATA, SQLiteBL.TABLE_NAME);
111 | sqliteDBHelper.delVal(blackListArr.get(i));
112 | sqliteDBHelper.close();
113 | setBlacklistLstView();
114 | }else if(which == 1){
115 | showEditDialog(blackListArr.get(i));
116 | }
117 | }
118 | });
119 | AlertDialog alertDialog = builder.create();
120 | alertDialog.getWindow().setType(new RequestDialog().getWindowType());
121 | alertDialog.show();
122 | }
123 | });
124 | if(blackListArr.size()>0){
125 | txvBlacklistOptions.setVisibility(View.VISIBLE);
126 | txvBlPageMsg.setVisibility(View.GONE);
127 | }else{
128 | txvBlacklistOptions.setVisibility(View.GONE);
129 | txvBlPageMsg.setVisibility(View.VISIBLE);
130 | }
131 | }
132 | @SuppressWarnings("deprecation")
133 | private void showEditDialog(final String item){
134 | AlertDialog.Builder builder = new AlertDialog.Builder(context, android.R.style.Theme_DeviceDefault_Dialog);
135 | builder.setTitle(context.getString(R.string.edit_blaclist_item));
136 | final EditText editText = new EditText(context);
137 | editText.setText(item);
138 | editText.setInputType(InputType.TYPE_CLASS_TEXT);
139 | LinearLayout parentLayout = new LinearLayout(context);
140 | LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
141 | LinearLayout.LayoutParams.MATCH_PARENT,
142 | LinearLayout.LayoutParams.MATCH_PARENT);
143 | layoutParams.setMargins(dpToPx(20), dpToPx(20), dpToPx(20), dpToPx(20));
144 | editText.setLayoutParams(layoutParams);
145 | parentLayout.addView(editText);
146 | builder.setView(parentLayout);
147 | builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
148 | @Override
149 | public void onClick(DialogInterface dialog, int which) {
150 | String newAddr = editText.getText().toString();
151 | if(newAddr.length() > 3) {
152 | sqliteDBHelper = new SqliteDBHelper(context,
153 | new SQLiteBL(context).getWritableDatabase(),
154 | SQLiteBL.BLACKLIST_DATA, SQLiteBL.TABLE_NAME);
155 | sqliteDBHelper.update(item, newAddr);
156 | sqliteDBHelper.close();
157 | setBlacklistLstView();
158 | }
159 | }
160 | });
161 | AlertDialog alertDialog = builder.create();
162 | alertDialog.getWindow().setType(new RequestDialog().getWindowType());
163 | alertDialog.show();
164 | }
165 | public static int dpToPx(int dp) {
166 | return (int) (dp * Resources.getSystem().getDisplayMetrics().density);
167 | }
168 | }
169 |
--------------------------------------------------------------------------------
/app/src/main/java/com/k3/k3pler/frag/MainPageInflater.java:
--------------------------------------------------------------------------------
1 | package com.k3.k3pler.frag;
2 |
3 |
4 | import android.app.Dialog;
5 | import android.content.Context;
6 | import android.os.Handler;
7 | import android.support.v4.view.ViewPager;
8 | import android.support.v4.widget.SwipeRefreshLayout;
9 | import android.support.v7.widget.DefaultItemAnimator;
10 | import android.support.v7.widget.LinearLayoutManager;
11 | import android.support.v7.widget.RecyclerView;
12 | import android.view.View;
13 | import android.view.ViewGroup;
14 | import android.widget.Button;
15 | import android.widget.TextView;
16 |
17 | import com.k3.k3pler.R;
18 | import com.k3.k3pler.handler.RequestDialog;
19 | import com.k3.k3pler.handler.SqliteDBHelper;
20 | import com.k3.k3pler.sub.HTTPReq;
21 | import com.k3.k3pler.sub.SQLiteBL;
22 |
23 | import java.util.ArrayList;
24 |
25 | /** Main page **/
26 | public class MainPageInflater {
27 | private Context context;
28 | private ViewGroup viewGroup;
29 | private SqliteDBHelper sqliteDBHelper;
30 | private ArrayList httpReqs;
31 | public interface IMainPage {
32 | void onRecyclerViewInit(RecyclerView recyclerView);
33 | void onTextViewInit(TextView textView);
34 | }
35 | // ** //
36 | private RecyclerView recyclerView;
37 | private SwipeRefreshLayout swpMain;
38 | private TextView txvMainPageMsg;
39 |
40 | public MainPageInflater(Context context, ViewGroup viewGroup, ArrayList httpReqs){
41 | this.context = context;
42 | this.viewGroup = viewGroup;
43 | this.httpReqs = httpReqs;
44 | }
45 | public void init(IMainPage iMainPage){
46 | txvMainPageMsg = viewGroup.findViewById(R.id.txvMainPageMsg);
47 | recyclerView = viewGroup.findViewById(R.id.recycler_view);
48 | LinearLayoutManager layoutManager = new LinearLayoutManager(context);
49 | layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
50 | recyclerView.setLayoutManager(layoutManager);
51 | recyclerView.setItemAnimator(new DefaultItemAnimator());
52 | iMainPage.onRecyclerViewInit(recyclerView);
53 | iMainPage.onTextViewInit(txvMainPageMsg);
54 | swpMain = viewGroup.findViewById(R.id.swpMain);
55 | swpMain.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
56 | @Override
57 | public void onRefresh() {
58 | new Handler().postDelayed(new Runnable() {
59 | @Override
60 | public void run() {
61 | httpReqs.clear();
62 | recyclerView.setAdapter(null);
63 | txvMainPageMsg.setVisibility(View.VISIBLE);
64 | swpMain.setRefreshing(false);
65 | }
66 | }, 800);
67 | }
68 | });
69 | }
70 | public void onDetailDialogItemClick(final HTTPReq item, final BlacklistPageInflater blacklistPageInflater,
71 | final ViewPager viewPager, final int pageID){
72 | new RequestDialog(context, item).show(new RequestDialog.IBtnBlackList() {
73 | @Override
74 | public void onInit(Button btnReqBlackList, final Dialog dialog, final String uri) {
75 | btnReqBlackList.setOnClickListener(new View.OnClickListener() {
76 | @Override
77 | public void onClick(View view) {
78 | sqliteDBHelper = new SqliteDBHelper(context,
79 | new SQLiteBL(context).getWritableDatabase(),
80 | SQLiteBL.BLACKLIST_DATA, SQLiteBL.TABLE_NAME);
81 | if(!sqliteDBHelper.getAll().contains(uri)) {
82 | sqliteDBHelper.insert(uri);
83 | }
84 | sqliteDBHelper.close();
85 | dialog.cancel();
86 | blacklistPageInflater.setBlacklistLstView();
87 | /* viewPager.setCurrentItem(pageID); */
88 | }
89 | });
90 | }
91 | });
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/app/src/main/java/com/k3/k3pler/frag/SettingsPageInflater.java:
--------------------------------------------------------------------------------
1 | package com.k3.k3pler.frag;
2 |
3 |
4 | import android.app.AlertDialog;
5 | import android.content.Context;
6 | import android.content.DialogInterface;
7 | import android.content.res.Resources;
8 | import android.text.InputType;
9 | import android.text.SpannableString;
10 | import android.text.style.UnderlineSpan;
11 | import android.view.View;
12 | import android.view.ViewGroup;
13 | import android.view.WindowManager;
14 | import android.widget.EditText;
15 | import android.widget.LinearLayout;
16 | import android.widget.TextView;
17 |
18 | import com.k3.k3pler.R;
19 | import com.k3.k3pler.handler.RequestDialog;
20 | import com.k3.k3pler.handler.SqliteDBHelper;
21 | import com.k3.k3pler.sub.SQLiteSettings;
22 |
23 | import java.util.ArrayList;
24 | import java.util.HashMap;
25 |
26 | /** Settings page **/
27 | public class SettingsPageInflater {
28 | private Context context;
29 | private ViewGroup viewGroup;
30 | private SqliteDBHelper sqliteDBHelper;
31 | private String defaultBuffer = "10485760", defaultBufferNum = "10x1024x1024";
32 | private String[] respOptions, matchOptions, splashOptions;
33 | // ** //
34 | private TextView txvStPort, txvStMaxBuffer, txvStMatchType, txvStBlResponse, txvStShowSplash, txvStRestart;
35 |
36 | public SettingsPageInflater(Context context, ViewGroup viewGroup){
37 | this.context = context;
38 | this.viewGroup = viewGroup;
39 | }
40 | public void init(){
41 | txvStPort = viewGroup.findViewById(R.id.txvStPort);
42 | txvStMaxBuffer = viewGroup.findViewById(R.id.txvStMaxBuffer);
43 | txvStMatchType = viewGroup.findViewById(R.id.txvStMatchType);
44 | txvStBlResponse = viewGroup.findViewById(R.id.txvStBlResponse);
45 | txvStShowSplash = viewGroup.findViewById(R.id.txvStShowSplash);
46 | txvStRestart = viewGroup.findViewById(R.id.txvStRestart);
47 | respOptions = new String[]{
48 | context.getString(R.string.resp_status_1),
49 | context.getString(R.string.resp_status_2),
50 | context.getString(R.string.resp_status_3),
51 | context.getString(R.string.resp_status_4),};
52 | matchOptions = new String[]{
53 | context.getString(R.string.match_type_1),
54 | context.getString(R.string.match_type_2)};
55 | splashOptions = new String[]{
56 | context.getString(R.string.option_y),
57 | context.getString(R.string.option_n)
58 | };
59 | setValues();
60 | }
61 | private void setValues(){
62 | ArrayList settings = getSettings();
63 | setTextWithUnderline(txvStPort, settings.get(0));
64 | if(settings.get(1).equals(defaultBuffer)){
65 | setTextWithUnderline(txvStMaxBuffer, defaultBufferNum);
66 | }else {
67 | setTextWithUnderline(txvStMaxBuffer, settings.get(1));
68 | }
69 | if(Integer.valueOf(settings.get(2))==0){
70 | setTextWithUnderline(txvStMatchType, context.getString(R.string.match_type_1));
71 | }else{
72 | setTextWithUnderline(txvStMatchType, context.getString(R.string.match_type_2));
73 | }
74 | setTextWithUnderline(txvStBlResponse, getRespText(Integer.valueOf(settings.get(3))));
75 | if(Integer.valueOf(settings.get(4))==0){
76 | setTextWithUnderline(txvStShowSplash, context.getString(R.string.option_y));
77 | }else{
78 | setTextWithUnderline(txvStShowSplash, context.getString(R.string.option_n));
79 | }
80 | txvStPort.setOnClickListener(new View.OnClickListener() {
81 | @Override
82 | public void onClick(View view) {
83 | showEditDialog(context.getString(R.string.lyt_port_addr).replace(":", ""),
84 | txvStPort.getText().toString(), SQLiteSettings.PORT_DATA);
85 | }
86 | });
87 | txvStMaxBuffer.setOnClickListener(new View.OnClickListener() {
88 | @Override
89 | public void onClick(View view) {
90 | showEditDialog(context.getString(R.string.lyt_max_buffer).replace(":", ""),
91 | txvStMaxBuffer.getText().toString(), SQLiteSettings.BUFFER_DATA);
92 | }
93 | });
94 | txvStMatchType.setOnClickListener(new View.OnClickListener() {
95 | @Override
96 | public void onClick(View view) {
97 | showSelectDialog(context.getString(R.string.lyt_match_type).replace(":", ""),
98 | txvStMatchType.getText().toString(), SQLiteSettings.MATCH_DATA, matchOptions);
99 | }
100 | });
101 | txvStBlResponse.setOnClickListener(new View.OnClickListener() {
102 | @Override
103 | public void onClick(View view) {
104 | showSelectDialog(context.getString(R.string.lyt_blacklist_response).replace(":", ""),
105 | txvStBlResponse.getText().toString(), SQLiteSettings.RESPONSE_DATA, respOptions);
106 | }
107 | });
108 | txvStShowSplash.setOnClickListener(new View.OnClickListener() {
109 | @Override
110 | public void onClick(View view) {
111 | showSelectDialog(context.getString(R.string.lyt_show_splash).replace(":", ""),
112 | txvStShowSplash.getText().toString(), SQLiteSettings.SPLASH_DATA, splashOptions);
113 | }
114 | });
115 | }
116 | private void setTextWithUnderline(TextView textView, String text){
117 | SpannableString content = new SpannableString(text);
118 | content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
119 | textView.setText(content);
120 | }
121 | public ArrayList getSettings(){
122 | Boolean notFound = false;
123 | int port = Integer.parseInt(context.getString(R.string.default_port));
124 | int buffer = 10 * 1024 * 1024;
125 | int match = Integer.parseInt(context.getString(R.string.default_matchtype));
126 | int resp = 0;
127 | int splash = 0;
128 | sqliteDBHelper = new SqliteDBHelper(context,
129 | new SQLiteSettings(context).getWritableDatabase(),
130 | SQLiteSettings.PORT_DATA, SQLiteSettings.TABLE_NAME);
131 | try {
132 | port = Integer.parseInt(sqliteDBHelper.get(SQLiteSettings.PORT_DATA));
133 | }catch (NumberFormatException e){
134 | e.printStackTrace();
135 | notFound = true;
136 | }
137 | sqliteDBHelper = new SqliteDBHelper(context,
138 | new SQLiteSettings(context).getWritableDatabase(),
139 | SQLiteSettings.BUFFER_DATA, SQLiteSettings.TABLE_NAME);
140 | try {
141 | buffer = Integer.parseInt(sqliteDBHelper.get(SQLiteSettings.BUFFER_DATA));
142 | }catch (NumberFormatException e){
143 | e.printStackTrace();
144 | notFound = true;
145 | }
146 | sqliteDBHelper = new SqliteDBHelper(context,
147 | new SQLiteSettings(context).getWritableDatabase(),
148 | SQLiteSettings.MATCH_DATA, SQLiteSettings.TABLE_NAME);
149 | try {
150 | match = Integer.parseInt(sqliteDBHelper.get(SQLiteSettings.MATCH_DATA));
151 | }catch (NumberFormatException e){
152 | e.printStackTrace();
153 | notFound = true;
154 | }
155 | sqliteDBHelper = new SqliteDBHelper(context,
156 | new SQLiteSettings(context).getWritableDatabase(),
157 | SQLiteSettings.RESPONSE_DATA, SQLiteSettings.TABLE_NAME);
158 | try {
159 | resp = Integer.parseInt(sqliteDBHelper.get(SQLiteSettings.RESPONSE_DATA));
160 | }catch (NumberFormatException e){
161 | e.printStackTrace();
162 | notFound = true;
163 | }
164 | sqliteDBHelper = new SqliteDBHelper(context,
165 | new SQLiteSettings(context).getWritableDatabase(),
166 | SQLiteSettings.SPLASH_DATA, SQLiteSettings.TABLE_NAME);
167 | try {
168 | splash = Integer.parseInt(sqliteDBHelper.get(SQLiteSettings.SPLASH_DATA));
169 | }catch (NumberFormatException e){
170 | e.printStackTrace();
171 | notFound = true;
172 | }
173 | if(notFound){
174 | sqliteDBHelper.deleteAll();
175 | HashMap hashMap = new HashMap<>();
176 | hashMap.put(SQLiteSettings.PORT_DATA, String.valueOf(port));
177 | hashMap.put(SQLiteSettings.BUFFER_DATA, String.valueOf(buffer));
178 | hashMap.put(SQLiteSettings.MATCH_DATA, String.valueOf(match));
179 | hashMap.put(SQLiteSettings.RESPONSE_DATA, String.valueOf(resp));
180 | hashMap.put(SQLiteSettings.SPLASH_DATA, String.valueOf(splash));
181 | sqliteDBHelper.insertMultiple(hashMap);
182 | }
183 | sqliteDBHelper.close();
184 | ArrayList arrayList = new ArrayList<>();
185 | arrayList.add(String.valueOf(port));
186 | arrayList.add(String.valueOf(buffer));
187 | arrayList.add(String.valueOf(match));
188 | arrayList.add(String.valueOf(resp));
189 | arrayList.add(String.valueOf(splash));
190 | return arrayList;
191 | }
192 |
193 | @SuppressWarnings("deprecation")
194 | private void showEditDialog(String title, String currentItem, final String DATA){
195 | if(currentItem.equals(defaultBufferNum)){currentItem=defaultBuffer;}
196 | final String currentItem1 = currentItem;
197 | AlertDialog.Builder builder = new AlertDialog.Builder(context, android.R.style.Theme_DeviceDefault_Dialog);
198 | builder.setTitle(title);
199 | final EditText editText = new EditText(context);
200 | editText.setText(currentItem);
201 | editText.setInputType(InputType.TYPE_CLASS_TEXT);
202 | LinearLayout parentLayout = new LinearLayout(context);
203 | LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
204 | LinearLayout.LayoutParams.MATCH_PARENT,
205 | LinearLayout.LayoutParams.MATCH_PARENT);
206 | layoutParams.setMargins(dpToPx(20), dpToPx(10), dpToPx(20), 0);
207 | editText.setLayoutParams(layoutParams);
208 | parentLayout.addView(editText);
209 | builder.setView(parentLayout);
210 | builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
211 | @Override
212 | public void onClick(DialogInterface dialog, int which) {
213 | String item = editText.getText().toString();
214 | if(item.length() > 3) {
215 | sqliteDBHelper = new SqliteDBHelper(context,
216 | new SQLiteSettings(context).getWritableDatabase(),
217 | DATA, SQLiteSettings.TABLE_NAME);
218 | sqliteDBHelper.update(currentItem1, item);
219 | sqliteDBHelper.close();
220 | setValues();
221 | }
222 | }
223 | });
224 | AlertDialog alertDialog = builder.create();
225 | alertDialog.getWindow().setType(new RequestDialog().getWindowType());
226 | alertDialog.show();
227 | }
228 | public static int dpToPx(int dp) {
229 | return (int) (dp * Resources.getSystem().getDisplayMetrics().density);
230 | }
231 | @SuppressWarnings("deprecation")
232 | private void showSelectDialog(String title, String currentItem, final String DATA, String[] options){
233 | if(DATA.equals(SQLiteSettings.MATCH_DATA)){
234 | if(currentItem.equals(context.getString(R.string.match_type_1))){currentItem="0";}else{currentItem="1";}
235 | }else if(DATA.equals(SQLiteSettings.RESPONSE_DATA)){
236 | currentItem = String.valueOf(getRespID(currentItem));
237 | }else if(DATA.equals(SQLiteSettings.SPLASH_DATA)){
238 | if(currentItem.equals(context.getString(R.string.option_y))){currentItem="0";}else{currentItem="1";}
239 | }
240 | final String currentItem1 = currentItem;
241 | AlertDialog.Builder builder = new AlertDialog.Builder(context, android.R.style.Theme_DeviceDefault_Dialog);
242 | builder.setTitle(title);
243 | builder.setItems(options, new DialogInterface.OnClickListener() {
244 | @Override
245 | public void onClick(DialogInterface dialog, int which) {
246 | sqliteDBHelper = new SqliteDBHelper(context,
247 | new SQLiteSettings(context).getWritableDatabase(),
248 | DATA, SQLiteSettings.TABLE_NAME);
249 | sqliteDBHelper.update(currentItem1, String.valueOf(which));
250 | sqliteDBHelper.close();
251 | setValues();
252 | }
253 | });
254 | AlertDialog alertDialog = builder.create();
255 | alertDialog.getWindow().setType(new RequestDialog().getWindowType());
256 | alertDialog.show();
257 | }
258 | private int getRespID(String resp){
259 | if(resp.equals(context.getString(R.string.resp_status_1)))
260 | return 0;
261 | else if(resp.equals(context.getString(R.string.resp_status_2)))
262 | return 1;
263 | else if(resp.equals(context.getString(R.string.resp_status_3)))
264 | return 2;
265 | else if(resp.equals(context.getString(R.string.resp_status_4)))
266 | return 3;
267 | else
268 | return -1;
269 | }
270 | private String getRespText(int ID){
271 | switch (ID){
272 | case 0:
273 | return context.getString(R.string.resp_status_1);
274 | case 1:
275 | return context.getString(R.string.resp_status_2);
276 | case 2:
277 | return context.getString(R.string.resp_status_3);
278 | case 3:
279 | return context.getString(R.string.resp_status_4);
280 | default:
281 | return "0";
282 | }
283 | }
284 |
285 | }
286 |
--------------------------------------------------------------------------------
/app/src/main/java/com/k3/k3pler/handler/LProxy.java:
--------------------------------------------------------------------------------
1 | package com.k3.k3pler.handler;
2 |
3 |
4 | import android.content.Context;
5 |
6 | import com.k3.k3pler.frag.BlacklistPageInflater;
7 | import com.k3.k3pler.sub.FilteredResponse;
8 | import com.k3.k3pler.sub.ProxyNotifier;
9 | import com.k3.k3pler.ui.ProxyService;
10 |
11 | import org.littleshoot.proxy.HttpFilters;
12 | import org.littleshoot.proxy.HttpFiltersSource;
13 | import org.littleshoot.proxy.HttpProxyServer;
14 | import org.littleshoot.proxy.impl.DefaultHttpProxyServer;
15 |
16 | import io.netty.channel.ChannelHandlerContext;
17 | import io.netty.handler.codec.http.HttpRequest;
18 | import io.netty.handler.codec.http.HttpResponseStatus;
19 |
20 | /** Start LittleProxy with parameters **/
21 | public class LProxy {
22 | private Context context;
23 | private String blacklist;
24 | private int PORT_NUMBER, MAX_BUFFER, MATCH_TYPE, RESPONSE_STATUS;
25 | public interface IProxyStatus {
26 | void onReceive(HttpRequest httpRequest, String blacklist);
27 | void onNotify(NotificationHandler notificationHandler, HttpProxyServer httpProxyServer);
28 | void onError(Exception e);
29 | }
30 | public LProxy(Context context, int PORT_NUMBER, int MAX_BUFFER, int MATCH_TYPE, int RESPONSE_STATUS){
31 | this.context = context;
32 | this.PORT_NUMBER = PORT_NUMBER;
33 | this.MAX_BUFFER = MAX_BUFFER;
34 | this.MATCH_TYPE = MATCH_TYPE;
35 | this.RESPONSE_STATUS = RESPONSE_STATUS;
36 | }
37 | public void start(final IProxyStatus proxyStatus){
38 | try {
39 | HttpProxyServer httpProxyServer = DefaultHttpProxyServer.bootstrap()
40 | .withPort(PORT_NUMBER)
41 | .withFiltersSource(new HttpFiltersSource() {
42 | @Override
43 | public HttpFilters filterRequest(HttpRequest originalRequest, ChannelHandlerContext ctx) {
44 | try {
45 | blacklist = new BlacklistPageInflater(context).getBlacklist();
46 | }catch (Exception e){e.printStackTrace();}
47 | try{
48 | proxyStatus.onReceive(originalRequest, blacklist);
49 | }catch (Exception e){ e.printStackTrace(); }
50 | return new FilteredResponse(originalRequest, blacklist, MATCH_TYPE, getResponseStatus(RESPONSE_STATUS));
51 | }
52 | @Override
53 | public int getMaximumRequestBufferSizeInBytes() {
54 | return MAX_BUFFER;
55 | }
56 |
57 | @Override
58 | public int getMaximumResponseBufferSizeInBytes() {
59 | return MAX_BUFFER;
60 | }
61 | }).start();
62 | NotificationHandler notificationHandler = new NotificationHandler(1, context, ProxyService.class);
63 | if(httpProxyServer != null){
64 | new ProxyNotifier(context, httpProxyServer, notificationHandler).execute();
65 | }else{
66 | throw new Exception("Failed to start proxy.");
67 | }
68 | if(proxyStatus!=null){
69 | proxyStatus.onNotify(notificationHandler, httpProxyServer);
70 | }
71 | }catch (Exception e){
72 | if(proxyStatus!=null){
73 | proxyStatus.onError(e);
74 | }
75 | e.printStackTrace();
76 | }
77 | }
78 | private HttpResponseStatus getResponseStatus(int ID){
79 | switch (ID){
80 | case 0:
81 | return HttpResponseStatus.BAD_GATEWAY;
82 | case 1:
83 | return HttpResponseStatus.BAD_REQUEST;
84 | case 2:
85 | return HttpResponseStatus.FORBIDDEN;
86 | case 3:
87 | return HttpResponseStatus.NOT_FOUND;
88 | default:
89 | return HttpResponseStatus.BAD_GATEWAY;
90 | }
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/app/src/main/java/com/k3/k3pler/handler/NotificationHandler.java:
--------------------------------------------------------------------------------
1 | package com.k3.k3pler.handler;
2 |
3 |
4 | import android.app.NotificationChannel;
5 | import android.app.NotificationManager;
6 | import android.app.PendingIntent;
7 | import android.content.Context;
8 | import android.content.Intent;
9 | import android.os.Build;
10 | import android.support.v4.app.NotificationCompat;
11 |
12 | import com.k3.k3pler.R;
13 |
14 | /** Handle notifications **/
15 | public class NotificationHandler {
16 | private Context context;
17 | private Class mClass;
18 | private int ID, btnID1 = 1, btnID2 = 2;
19 | private NotificationManager notificationManager;
20 | private int pendingFlag = PendingIntent.FLAG_UPDATE_CURRENT;
21 |
22 | public NotificationHandler(int ID, Context context, Class mClass){
23 | this.ID = ID;
24 | this.context = context;
25 | this.mClass = mClass;
26 | }
27 | public Intent getIntent(){
28 | Intent intent = new Intent(context, mClass);
29 | intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
30 | return intent;
31 | }
32 | public PendingIntent getPendingIntent(Intent intent){
33 | return PendingIntent.getService(context, 0, intent,
34 | pendingFlag);
35 | }
36 | private NotificationManager createNotificationManager(){
37 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
38 | NotificationChannel channel = new NotificationChannel(String.valueOf(ID),
39 | context.getString(R.string.app_name) + String.valueOf(ID),
40 | NotificationManager.IMPORTANCE_DEFAULT);
41 | channel.setDescription(context.getString(R.string.app_name) + String.valueOf(ID));
42 | NotificationManager notificationManager = (NotificationManager) context
43 | .getSystemService(Context.NOTIFICATION_SERVICE);
44 | notificationManager.createNotificationChannel(channel);
45 | return notificationManager;
46 | }else{
47 | return (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
48 | }
49 | }
50 | public NotificationManager getNotificationManager(){
51 | return notificationManager;
52 | }
53 | private PendingIntent getStopPendingIntent(){
54 | Intent intent = getIntent();
55 | intent.putExtra(context.getString(R.string.proxy_stop), true);
56 | return PendingIntent.getService(context, btnID1, intent,
57 | pendingFlag);
58 | }
59 | private PendingIntent getShowPendingIntent(){
60 | Intent intent = getIntent();
61 | intent.putExtra(context.getString(R.string.show_gui), true);
62 | return PendingIntent.getService(context, btnID2, intent,
63 | pendingFlag);
64 | }
65 | public void notify(String messageTitle, String messageBody, Boolean isOnGoing) {
66 | NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context, String.valueOf(ID))
67 | .setSmallIcon(R.mipmap.k3pler_logo)
68 | .addAction(0, context.getString(R.string.proxy_stop), getStopPendingIntent())
69 | .setContentTitle(messageTitle)
70 | .setContentText(messageBody)
71 | .setAutoCancel(false)
72 | .setOngoing(isOnGoing)
73 | .setContentIntent(getShowPendingIntent());
74 | notificationManager = createNotificationManager();
75 | notificationManager.notify(ID, notificationBuilder.build());
76 | }
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/app/src/main/java/com/k3/k3pler/handler/RequestDialog.java:
--------------------------------------------------------------------------------
1 | package com.k3.k3pler.handler;
2 |
3 |
4 | import android.app.Dialog;
5 | import android.content.ClipData;
6 | import android.content.ClipboardManager;
7 | import android.content.Context;
8 | import android.os.Build;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.Window;
12 | import android.view.WindowManager;
13 | import android.widget.Button;
14 | import android.widget.TextView;
15 |
16 | import com.k3.k3pler.R;
17 | import com.k3.k3pler.adapter.RequestAdapter;
18 | import com.k3.k3pler.sub.HTTPReq;
19 |
20 | /** Show detailed info about request **/
21 | public class RequestDialog {
22 | private Context context;
23 | private Dialog reqDialog;
24 | private HTTPReq httpReq;
25 | public interface IBtnBlackList{
26 | void onInit(Button btnReqBlackList, Dialog dialog, String uri);
27 | }
28 | // * //
29 | private TextView txvReqAddr, txvReqMethod, txvReqProtocol, txvReqResult, txvReqTime;
30 | private Button btnReqBlacklist;
31 |
32 | public RequestDialog(Context context, HTTPReq httpReq){
33 | this.context = context;
34 | this.httpReq = httpReq;
35 | }
36 | public RequestDialog(){}
37 | private void initDialog(Dialog dialog){
38 | txvReqAddr = dialog.findViewById(R.id.txvReqAddr);
39 | txvReqMethod = dialog.findViewById(R.id.txvReqMethod);
40 | txvReqProtocol = dialog.findViewById(R.id.txvReqProtocol);
41 | txvReqResult = dialog.findViewById(R.id.txvReqResult);
42 | txvReqTime = dialog.findViewById(R.id.txvReqTime);
43 | btnReqBlacklist = dialog.findViewById(R.id.btnReqBlacklist);
44 | }
45 | @SuppressWarnings("deprecation")
46 | public void show(IBtnBlackList iBtnBlackList){
47 | try {
48 | LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
49 | reqDialog = new Dialog(context);
50 | reqDialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
51 | reqDialog.getWindow().setType(getWindowType());
52 | reqDialog.setContentView(inflater.inflate(R.layout.layout_req_detail, null));
53 | initDialog(reqDialog);
54 | txvReqAddr.setText(httpReq.getUri());
55 | txvReqAddr.setOnClickListener(new View.OnClickListener() {
56 | @Override
57 | public void onClick(View view) {
58 | copyToClipBoard(txvReqAddr.getText().toString());
59 | reqDialog.dismiss();
60 | }
61 | });
62 | txvReqMethod.setText(httpReq.getMethod());
63 | txvReqProtocol.setText(httpReq.getProtocol());
64 | txvReqResult.setText(RequestAdapter.getLongResult(httpReq.getResult()));
65 | txvReqTime.setText(httpReq.getTime().replace("{", "").replace("}", ""));
66 | reqDialog.show();
67 | iBtnBlackList.onInit(btnReqBlacklist, reqDialog, httpReq.getUri());
68 | }catch (Exception e){
69 | e.printStackTrace();
70 | }
71 | }
72 | private void copyToClipBoard(String data){
73 | try{
74 | ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
75 | ClipData clip = ClipData.newPlainText(context.getString(R.string.app_name), data);
76 | clipboard.setPrimaryClip(clip);
77 | }catch (Exception e){
78 | e.printStackTrace();
79 | }
80 | }
81 | @SuppressWarnings("deprecation")
82 | public int getWindowType(){
83 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
84 | return WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
85 | }else{
86 | return WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
87 | }
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/app/src/main/java/com/k3/k3pler/handler/ServiceController.java:
--------------------------------------------------------------------------------
1 | package com.k3.k3pler.handler;
2 |
3 |
4 | import android.app.Activity;
5 | import android.content.Context;
6 | import android.content.Intent;
7 | import android.content.ServiceConnection;
8 |
9 | /** Start/stop service **/
10 | public class ServiceController {
11 | private Activity activity;
12 | private Class service;
13 | public ServiceController(Activity activity, Class service){
14 | this.activity = activity;
15 | this.service = service;
16 | }
17 | public Intent getIntent(){
18 | return new Intent(activity, service);
19 | }
20 | public void startServiceWithBind(ServiceConnection serviceConnection) throws Exception {
21 | startService();
22 | bindService(serviceConnection);
23 | }
24 | public void bindService(ServiceConnection serviceConnection){
25 | activity.bindService(getIntent(), serviceConnection, Context.BIND_AUTO_CREATE);
26 | }
27 | public void unbindService(ServiceConnection serviceConnection){
28 | activity.unbindService(serviceConnection);
29 | }
30 | public void startService() throws Exception{
31 | activity.startService(getIntent());
32 | }
33 | public void stopService() throws Exception {
34 | activity.stopService(getIntent());
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/main/java/com/k3/k3pler/handler/SqliteDBHelper.java:
--------------------------------------------------------------------------------
1 | package com.k3.k3pler.handler;
2 |
3 | import android.content.ContentValues;
4 | import android.content.Context;
5 | import android.database.Cursor;
6 | import android.database.sqlite.SQLiteDatabase;
7 | import java.util.HashMap;
8 | import java.util.Iterator;
9 | import java.util.Map;
10 |
11 | /** SQLite connections **/
12 | public class SqliteDBHelper {
13 |
14 | private static SQLiteDatabase db;
15 | private Context context;
16 | private String column, table;
17 | public static String SPLIT_CHAR = "~";
18 |
19 | public SqliteDBHelper(Context context, SQLiteDatabase db, String column, String table){
20 | this.context = context;
21 | this.column = column;
22 | this.table = table;
23 | this.db = db;
24 | }
25 | public void setColumn(String column){
26 | this.column = column;
27 | }
28 | public Boolean insert(String requestAddr){
29 | try {
30 | ContentValues contentValues = new ContentValues();
31 | contentValues.put(column, requestAddr);
32 | db.insert(table, null, contentValues);
33 | return true;
34 | }catch(Exception e) {
35 | e.printStackTrace();
36 | }
37 | return false;
38 | }
39 | public Boolean insertMultiple(HashMap hashMap) {
40 | try {
41 | ContentValues contentValues = new ContentValues();
42 | Iterator it = hashMap.entrySet().iterator();
43 | while (it.hasNext()) {
44 | Map.Entry pair = (Map.Entry)it.next();
45 | contentValues.put(pair.getKey().toString(),
46 | pair.getValue().toString());
47 | it.remove();
48 | }
49 |
50 | db.insert(table, null, contentValues);
51 | return true;
52 | }catch(Exception e) {
53 | e.printStackTrace();
54 | }
55 | return false;
56 | }
57 | public String get(String column1) {
58 | String data = "";
59 | try {
60 | String[] columns = {column1};
61 | Cursor read = db.query(table, columns, null, null, null, null, null);
62 | while (read.moveToNext()) {
63 | data = read.getString(read.getColumnIndex(column1));
64 | }
65 | }catch(Exception e){
66 | e.printStackTrace();
67 | return null;
68 | }
69 | return data;
70 | }
71 | public String getAll() {
72 | String allData = "";
73 | try {
74 | String[] columns = {column};
75 | Cursor read = db.query(table, columns, null, null, null, null, null);
76 | while (read.moveToNext()) {
77 | allData += read.getString(read.getColumnIndex(column)) + SPLIT_CHAR;
78 | }
79 | }catch(Exception e){
80 | e.printStackTrace();
81 | return null;
82 | }
83 | return allData;
84 | }
85 | public Boolean update(String requestAddr, String newAddr){
86 | try {
87 | ContentValues contentValues = new ContentValues();
88 | contentValues.put(column, newAddr);
89 | db.update(table, contentValues, column + " = ?", new String[]{requestAddr});
90 | return true;
91 | }catch(Exception e){
92 | e.printStackTrace();
93 | }
94 | return false;
95 | }
96 | public Boolean delVal(String requestAddr){
97 | try {
98 | db.delete(table, column + " = ?", new String[]{requestAddr});
99 | return true;
100 | }catch (Exception e){
101 | e.printStackTrace();
102 | }
103 | return false;
104 | }
105 | public Boolean deleteAll(){
106 | try {
107 | db.execSQL("DELETE FROM "+ table);
108 | return true;
109 | }catch(Exception e){
110 | e.printStackTrace();
111 | }
112 | return false;
113 | }
114 | public Boolean close(){
115 | try{
116 | db.close();
117 | return true;
118 | }catch (Exception e){
119 | e.printStackTrace();
120 | return false;
121 | }
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/app/src/main/java/com/k3/k3pler/sub/FilteredResponse.java:
--------------------------------------------------------------------------------
1 | package com.k3.k3pler.sub;
2 |
3 |
4 | import com.k3.k3pler.handler.SqliteDBHelper;
5 |
6 | import org.littleshoot.proxy.HttpFiltersAdapter;
7 |
8 | import io.netty.handler.codec.http.DefaultFullHttpResponse;
9 | import io.netty.handler.codec.http.HttpHeaders;
10 | import io.netty.handler.codec.http.HttpObject;
11 | import io.netty.handler.codec.http.HttpRequest;
12 | import io.netty.handler.codec.http.HttpResponse;
13 | import io.netty.handler.codec.http.HttpResponseStatus;
14 | import io.netty.handler.codec.http.HttpVersion;
15 |
16 | /** Response for blacklisted requests **/
17 | public class FilteredResponse extends HttpFiltersAdapter {
18 | private HttpResponse httpResponse;
19 | private HttpResponseStatus httpResponseStatus = HttpResponseStatus.BAD_GATEWAY;
20 | private String blackListArr[], blackList;
21 | private int matchType = 0;
22 | public FilteredResponse(HttpRequest originalRequest,
23 | String blackList, int matchType,
24 | HttpResponseStatus httpResponseStatus){
25 | super(originalRequest, null);
26 | this.blackList = blackList;
27 | this.blackListArr = blackList.split("["+SqliteDBHelper.SPLIT_CHAR+"]");
28 | this.matchType = matchType;
29 | this.httpResponseStatus = httpResponseStatus;
30 | }
31 | public FilteredResponse(int matchType){
32 | super(null, null);
33 | this.matchType = matchType;
34 | }
35 | @Override
36 | public HttpResponse clientToProxyRequest(HttpObject httpObject) {
37 | if(isBlacklisted(originalRequest.getUri(), blackListArr))
38 | return getBlockedResponse();
39 | return super.clientToProxyRequest(httpObject);
40 | }
41 | public boolean isBlacklisted(String uri, String[] bl){
42 | Boolean blocked = false;
43 | if(bl.length>0) {
44 | for (String item : bl) {
45 | if(item != null && item.length()>3) {
46 | if(matchType == 0){
47 | if(uri.equals(item)){
48 | blocked = true;
49 | break;
50 | }
51 | }else {
52 | if (uri.contains(item)) {
53 | blocked = true;
54 | break;
55 | }
56 | }
57 | }
58 | }
59 | }
60 | return blocked;
61 | }
62 | private HttpResponse getBlockedResponse(){
63 | httpResponse = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, httpResponseStatus);
64 | HttpHeaders.setHeader(httpResponse, HttpHeaders.Names.CONNECTION, HttpHeaders.Values.CLOSE);
65 | return httpResponse;
66 | }
67 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/k3/k3pler/sub/HTTPReq.java:
--------------------------------------------------------------------------------
1 | package com.k3.k3pler.sub;
2 |
3 | import io.netty.handler.codec.DecoderResult;
4 |
5 | /** HTTP Request implementation **/
6 | public class HTTPReq {
7 | private String uri, method, protocol, time;
8 | private DecoderResult result;
9 | private Boolean blocked;
10 | public HTTPReq(String uri, String method, String protocol,
11 | DecoderResult result, String time, Boolean blocked){
12 | this.uri = uri;
13 | this.method = method;
14 | this.protocol = protocol;
15 | this.result = result;
16 | this.time = time;
17 | this.blocked = blocked;
18 | }
19 |
20 | public String getUri() {
21 | return uri;
22 | }
23 |
24 | public String getMethod() {
25 | return method;
26 | }
27 |
28 | public String getProtocol() {
29 | return protocol;
30 | }
31 |
32 | public DecoderResult getResult() {
33 | return result;
34 | }
35 |
36 | public String getTime() {
37 | return time;
38 | }
39 |
40 | public Boolean getBlocked() {
41 | return blocked;
42 | }
43 | public void setProtocol(String protocol) {
44 | this.protocol = protocol;
45 | }
46 |
47 | public void setResult(DecoderResult result) {
48 | this.result = result;
49 | }
50 |
51 | public void setUri(String uri) {
52 | this.uri = uri;
53 | }
54 |
55 | public void setMethod(String method) {
56 | this.method = method;
57 | }
58 |
59 | public void setTime(String time) {
60 | this.time = time;
61 | }
62 |
63 | public void setBlocked(Boolean blocked) {
64 | this.blocked = blocked;
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/app/src/main/java/com/k3/k3pler/sub/ProxyNotifier.java:
--------------------------------------------------------------------------------
1 | package com.k3.k3pler.sub;
2 |
3 | import android.content.Context;
4 | import android.os.AsyncTask;
5 |
6 | import com.k3.k3pler.R;
7 | import com.k3.k3pler.handler.NotificationHandler;
8 |
9 | import org.littleshoot.proxy.HttpProxyServer;
10 |
11 | /** Get proxy details and show with notificationHandler **/
12 | public class ProxyNotifier extends AsyncTask {
13 | private Context context;
14 | private HttpProxyServer httpProxyServer;
15 | private NotificationHandler notificationHandler;
16 |
17 | public ProxyNotifier(Context context, HttpProxyServer httpProxyServer,
18 | NotificationHandler notificationHandler){
19 | this.context = context;
20 | this.httpProxyServer = httpProxyServer;
21 | this.notificationHandler = notificationHandler;
22 | }
23 |
24 | @Override
25 | protected String doInBackground(Void... voids) {
26 | return httpProxyServer.getListenAddress().getHostName() + ":" +
27 | String.valueOf(httpProxyServer.getListenAddress().getPort());
28 | }
29 | @Override
30 | protected void onPostExecute(String str) {
31 | super.onPostExecute(str);
32 | notificationHandler.notify(context.getString(R.string.app_name),
33 | context.getString(R.string.proxy_running) + " [" + str + "]", true);
34 | }
35 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/k3/k3pler/sub/SQLiteBL.java:
--------------------------------------------------------------------------------
1 | package com.k3.k3pler.sub;
2 |
3 | import android.content.Context;
4 | import android.database.sqlite.SQLiteDatabase;
5 | import android.database.sqlite.SQLiteOpenHelper;
6 |
7 | /** Blacklist database **/
8 | public class SQLiteBL extends SQLiteOpenHelper {
9 |
10 | private static final int VERSION = 1;
11 | private static String DB_NAME = "k3blacklist.db";
12 | public static String TABLE_NAME = "k3table";
13 | public static String BLACKLIST_DATA = "BLACKLIST";
14 | private String CREATE_DB = "create table "+TABLE_NAME+
15 | "("+BLACKLIST_DATA+" text);";
16 |
17 | public SQLiteBL(Context context) {
18 | super(context, DB_NAME, null, VERSION);
19 | }
20 | @Override
21 | public void onCreate(SQLiteDatabase db){
22 | try {
23 | db.execSQL(CREATE_DB);
24 | }catch(Exception e){
25 | e.printStackTrace();
26 | }
27 | }
28 | @Override
29 | public void onUpgrade(SQLiteDatabase db, int oldVer, int newVer){
30 | try {
31 | db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
32 | onCreate(db);
33 | }catch(Exception e){e.printStackTrace();}
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/com/k3/k3pler/sub/SQLiteSettings.java:
--------------------------------------------------------------------------------
1 | package com.k3.k3pler.sub;
2 |
3 | import android.content.Context;
4 | import android.database.sqlite.SQLiteDatabase;
5 | import android.database.sqlite.SQLiteOpenHelper;
6 |
7 | /** Settings database **/
8 | public class SQLiteSettings extends SQLiteOpenHelper {
9 |
10 | private static final int VERSION = 1;
11 | private static String DB_NAME = "k3settings.db";
12 | public static String TABLE_NAME = "k3table";
13 | public static String PORT_DATA = "PORT", BUFFER_DATA = "MAX_BUFFER",
14 | MATCH_DATA = "MATCH_TYPE", RESPONSE_DATA = "BLACKLIST_RESPONSE",
15 | SPLASH_DATA = "SHOW_SPLASH";
16 | private String CREATE_DB = "create table "+TABLE_NAME+
17 | "("+ PORT_DATA + " text, " + BUFFER_DATA + " text, "
18 | + MATCH_DATA + " text, " + RESPONSE_DATA +" text, "+
19 | SPLASH_DATA +" text);";
20 |
21 | public SQLiteSettings(Context context) {
22 | super(context, DB_NAME, null, VERSION);
23 | }
24 | @Override
25 | public void onCreate(SQLiteDatabase db){
26 | try {
27 | db.execSQL(CREATE_DB);
28 | }catch(Exception e){
29 | e.printStackTrace();
30 | }
31 | }
32 | @Override
33 | public void onUpgrade(SQLiteDatabase db, int oldVer, int newVer){
34 | try {
35 | db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
36 | onCreate(db);
37 | }catch(Exception e){e.printStackTrace();}
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/java/com/k3/k3pler/sub/TextViewEFX.java:
--------------------------------------------------------------------------------
1 | package com.k3.k3pler.sub;
2 |
3 | import android.os.Handler;
4 | import android.util.Log;
5 | import android.widget.TextView;
6 |
7 | import java.util.Random;
8 |
9 | /** TextView setText effect **/
10 | public class TextViewEFX {
11 | private static String randomStr = "あたアカサザジズゼゾシスセソキクケコイウエオジャな";
12 | private String tmpChr = "";
13 | private Random random = new Random();
14 | private static int ms1 = 50, ms2 = 30, itCnt = 5;
15 | private String rnd;
16 |
17 | public void useFX(final TextView textView, final String text){
18 | textView.setText("");
19 | for (int i = 0; i < text.length(); i++){
20 | final int i1 = i;
21 | new Handler().postDelayed(new Runnable() {
22 | @Override
23 | public void run() {
24 | for (int a = 0; a < itCnt; a++){
25 | rnd = String.valueOf(
26 | randomStr.toLowerCase().charAt(random.nextInt(randomStr.length()))
27 | );
28 | final int b = a;
29 | new Handler().postDelayed(new Runnable() {
30 | @Override
31 | public void run() {
32 | try {
33 | if (b == itCnt - 1) {
34 | tmpChr += String.valueOf(text.charAt(i1));
35 | } else {
36 | if (i1 == text.length() - 1) {
37 | textView.setText(text);
38 | }else {
39 | textView.setText(tmpChr + rnd);
40 | }
41 | }
42 | }catch (Exception e){
43 | e.printStackTrace();
44 | }
45 | }
46 | }, a * ms2);
47 | }
48 | }
49 | }, i * ms1);
50 | }
51 | }
52 | public String getRandomStr(int len){ /* Not used. */
53 | String rnd = "";
54 | for (int i = 0; i < len; i++){
55 | rnd += String.valueOf(
56 | randomStr.toLowerCase().charAt(random.nextInt(randomStr.length()))
57 | );
58 | }
59 | return rnd;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/app/src/main/java/com/k3/k3pler/ui/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.k3.k3pler.ui;
2 |
3 | import android.app.Activity;
4 |
5 | import android.content.Intent;
6 | import android.net.Uri;
7 | import android.os.Build;
8 | import android.os.Bundle;
9 | import android.provider.Settings;
10 | import android.view.MotionEvent;
11 | import android.view.WindowManager;
12 |
13 | import com.k3.k3pler.handler.ServiceController;
14 |
15 | /** Entry point for application **/
16 | public class MainActivity extends Activity {
17 | private ServiceController serviceController;
18 | private int OVERLAY_REQUEST = 0x63;
19 |
20 | private void init(){
21 | getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
22 | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE );
23 | serviceController = new ServiceController(this, ProxyService.class);
24 | }
25 |
26 | @Override
27 | protected void onCreate(Bundle savedInstanceState) {
28 | super.onCreate(savedInstanceState);
29 | init();
30 | checkDrawOverlayPermission();
31 | }
32 | public void checkDrawOverlayPermission() {
33 | if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){
34 | if (!Settings.canDrawOverlays(getApplicationContext())) {
35 | Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
36 | Uri.parse("package:" + getPackageName()));
37 | startActivityForResult(intent, OVERLAY_REQUEST);
38 | }else{
39 | startProxy();
40 | }
41 | } else{
42 | startProxy();
43 | }
44 | }
45 | private void startProxy(){
46 | stopProxyService();
47 | try{
48 | serviceController.startService();
49 | }catch (Exception e1){
50 | e1.printStackTrace();
51 | stopProxyService();
52 | }
53 | finish();
54 | }
55 | private void stopProxyService(){
56 | try{
57 | serviceController.stopService();
58 | }catch (Exception e){
59 | e.printStackTrace();
60 | }
61 | }
62 | @Override
63 | protected void onActivityResult(int requestCode, int resultCode, Intent data) {
64 | if (requestCode == OVERLAY_REQUEST) {
65 | if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
66 | if (Settings.canDrawOverlays(this)) {
67 | startProxy();
68 | }
69 | }
70 | }
71 | }
72 | @Override
73 | protected void onDestroy() {
74 | super.onDestroy();
75 | }
76 | @Override
77 | public void onBackPressed() {}
78 | @Override
79 | public boolean onTouchEvent(MotionEvent ev) {
80 | return false;
81 | }
82 |
83 | }
84 |
85 |
86 |
--------------------------------------------------------------------------------
/app/src/main/java/com/k3/k3pler/ui/ProxyService.java:
--------------------------------------------------------------------------------
1 | package com.k3.k3pler.ui;
2 |
3 | import android.app.Dialog;
4 | import android.app.Service;
5 | import android.content.Context;
6 | import android.content.Intent;
7 | import android.os.Binder;
8 | import android.os.Handler;
9 | import android.os.IBinder;
10 | import android.support.v4.content.ContextCompat;
11 | import android.support.v4.view.ViewPager;
12 | import android.support.v7.widget.RecyclerView;
13 | import android.text.Html;
14 | import android.util.Log;
15 | import android.view.LayoutInflater;
16 | import android.view.View;
17 | import android.view.ViewGroup;
18 | import android.view.Window;
19 | import android.view.WindowManager;
20 | import android.widget.RelativeLayout;
21 | import android.widget.TextView;
22 |
23 | import com.k3.k3pler.frag.AboutPageInflater;
24 | import com.k3.k3pler.frag.BlacklistPageInflater;
25 | import com.k3.k3pler.frag.SettingsPageInflater;
26 | import com.k3.k3pler.handler.LProxy;
27 | import com.k3.k3pler.handler.RequestDialog;
28 | import com.k3.k3pler.handler.SqliteDBHelper;
29 | import com.k3.k3pler.R;
30 | import com.k3.k3pler.sub.TextViewEFX;
31 | import com.k3.k3pler.adapter.LayoutPagerAdapter;
32 | import com.k3.k3pler.adapter.RequestAdapter;
33 | import com.k3.k3pler.frag.MainPageInflater;
34 | import com.k3.k3pler.handler.NotificationHandler;
35 | import com.k3.k3pler.sub.FilteredResponse;
36 | import com.k3.k3pler.sub.HTTPReq;
37 |
38 | import org.littleshoot.proxy.HttpProxyServer;
39 |
40 | import java.text.DateFormat;
41 | import java.text.SimpleDateFormat;
42 | import java.util.ArrayList;
43 | import java.util.Calendar;
44 | import java.util.Collections;
45 | import java.util.Locale;
46 |
47 | import io.netty.handler.codec.http.HttpRequest;
48 |
49 | /** Main service **/
50 | public class ProxyService extends Service {
51 |
52 | public HttpProxyServer httpProxyServer;
53 | private NotificationHandler notificationHandler;
54 | private final IBinder mBinder = new Binder();
55 | private Intent currentIntent;
56 | private static ArrayList httpReqs = new ArrayList<>();
57 | private ArrayList settings = new ArrayList<>();
58 | private Dialog guiDialog, splashDialog;
59 | private String decoderResult = "", arrowChar = " > ";
60 | private Handler mainHandler;
61 | private LayoutPagerAdapter layoutPagerAdapter;
62 | private Boolean pageBackwards = false;
63 | private enum pageIDs {
64 | Main(0),
65 | BlackList(1),
66 | Settings(2),
67 | About(3);
68 | private int ID;
69 | private pageIDs(int ID){
70 | this.ID = ID;
71 | }
72 | private int getID(){
73 | return ID;
74 | }
75 | }
76 | // ** //
77 | private TextView txvPage, txvNum, txvMainPageMsg;
78 | private RecyclerView mRecyclerView;
79 | private ViewPager viewPager;
80 | private RelativeLayout rlMain;
81 | private MainPageInflater mainPageInflater;
82 | private BlacklistPageInflater blacklistPageInflater;
83 | private SettingsPageInflater settingsPageInflater;
84 | private AboutPageInflater aboutPageInflater;
85 |
86 | public ProxyService() {}
87 |
88 | @Override
89 | public IBinder onBind(Intent intent) { return mBinder; }
90 |
91 | @Override
92 | public void onCreate() {
93 | super.onCreate();
94 | }
95 |
96 | @Override
97 | public int onStartCommand(Intent currentIntent, int flags, int startId) {
98 | this.currentIntent = currentIntent;
99 | this.checkExtras();
100 | return START_NOT_STICKY;
101 | }
102 | private void checkExtras() {
103 | if (currentIntent != null) {
104 | try {
105 | if (currentIntent.getBooleanExtra(getString(R.string.show_gui), false)) {
106 | showGuiDialog();
107 | } else if (currentIntent.getBooleanExtra(getString(R.string.proxy_stop), false)) {
108 | stopSelf();
109 | } else{
110 | showGUI();
111 | }
112 | } catch (Exception e) {
113 | e.printStackTrace();
114 | }
115 | }else{
116 | showGUI();
117 | }
118 | }
119 | @SuppressWarnings("deprecation")
120 | private void initGUI(Dialog dialog){
121 | txvPage = dialog.findViewById(R.id.txvPage);
122 | txvNum = dialog.findViewById(R.id.txvNum);
123 | viewPager = dialog.findViewById(R.id.viewPager);
124 | viewPager.setOffscreenPageLimit(5);
125 | rlMain = dialog.findViewById(R.id.rlMain);
126 | layoutPagerAdapter = new LayoutPagerAdapter(getApplicationContext(), new LayoutPagerAdapter.IViewPager() {
127 | @Override
128 | public void onViewsAdded(ArrayList layouts) {
129 | try {
130 | mainPageInflater = new MainPageInflater(getApplicationContext(), layouts.get(pageIDs.Main.getID()), httpReqs);
131 | mainPageInflater.init(new MainPageInflater.IMainPage() {
132 | @Override
133 | public void onRecyclerViewInit(RecyclerView recyclerView) {
134 | mRecyclerView = recyclerView;
135 | }
136 | @Override
137 | public void onTextViewInit(TextView textView) {
138 | txvMainPageMsg = textView;
139 | }
140 | });
141 | }catch (Exception e){
142 | e.printStackTrace();
143 | }
144 | try {
145 | blacklistPageInflater = new BlacklistPageInflater(getApplicationContext(), layouts.get(pageIDs.BlackList.getID()));
146 | blacklistPageInflater.init();
147 | }catch (Exception e){
148 | e.printStackTrace();
149 | }
150 | try {
151 | settingsPageInflater = new SettingsPageInflater(getApplicationContext(), layouts.get(pageIDs.Settings.getID()));
152 | settingsPageInflater.init();
153 | }catch (Exception e){
154 | e.printStackTrace();
155 | }
156 | try {
157 | aboutPageInflater = new AboutPageInflater(getApplicationContext(), layouts.get(pageIDs.About.getID()), guiDialog);
158 | aboutPageInflater.init();
159 | }catch (Exception e){
160 | e.printStackTrace();
161 | }
162 | }
163 | });
164 | viewPager.setAdapter(layoutPagerAdapter);
165 | new TextViewEFX().useFX(txvPage, arrowChar + getString(LayoutPagerAdapter.PagerEnum.MainPage.getTitleResId()));
166 | onViewPager_select(pageIDs.Main.getID());
167 | viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
168 | @Override
169 | public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {}
170 | @Override
171 | public void onPageScrollStateChanged(int state) {}
172 | @Override
173 | public void onPageSelected(int position) {
174 | new TextViewEFX().useFX(txvPage, arrowChar + getString(LayoutPagerAdapter.PagerEnum.values()[position].getTitleResId()));
175 | onViewPager_select(position);
176 | }
177 | });
178 | txvNum.setOnClickListener(new View.OnClickListener() {
179 | @Override
180 | public void onClick(View view) {
181 | try {
182 | if(viewPager.getCurrentItem() + 1 != layoutPagerAdapter.getCount()
183 | && !pageBackwards || viewPager.getCurrentItem() - 1 == -1) {
184 | pageBackwards = false;
185 | viewPager.setCurrentItem(viewPager.getCurrentItem() + 1, true);
186 | }else{
187 | pageBackwards = true;
188 | viewPager.setCurrentItem(viewPager.getCurrentItem() - 1, true);
189 | }
190 | }catch (Exception e1){
191 | e1.printStackTrace();
192 | }
193 | }
194 | });
195 | }
196 | private interface ISplash{
197 | void onShow();
198 | }
199 | @SuppressWarnings("deprecation")
200 | private void showSplash(final ISplash iSplash){
201 | try {
202 | settings = new SettingsPageInflater(getApplicationContext(), null).getSettings();
203 | if (Integer.valueOf(settings.get(4)) == 1) {
204 | iSplash.onShow();
205 | } else {
206 | try {
207 | LayoutInflater inflater = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
208 | splashDialog = new Dialog(this, android.R.style.Theme_Black);
209 | splashDialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
210 | splashDialog.getWindow().setType(new RequestDialog().getWindowType());
211 | splashDialog.setContentView(inflater.inflate(R.layout.layout_splash, null));
212 | /* splashDialog.setCancelable(false); */
213 | final TextView txvK3Load = splashDialog.findViewById(R.id.txvK3Load);
214 | final String loadDots = "...";
215 | final int delay1 = 800, delay2 = 1200;
216 | for (int s = 0; s < loadDots.toCharArray().length; s++) {
217 | final int i = s;
218 | new Handler().postDelayed(new Runnable() {
219 | @Override
220 | public void run() {
221 | txvK3Load.setText("[" + txvK3Load.getText().toString().replace("[", "").replace("]", "") +
222 | String.valueOf(loadDots.toCharArray()[i]) + "]");
223 | if (i == loadDots.toCharArray().length - 1) {
224 | new Handler().postDelayed(new Runnable() {
225 | @Override
226 | public void run() {
227 | iSplash.onShow();
228 | }
229 | }, delay2);
230 | }
231 | }
232 | }, s * delay1);
233 | }
234 | splashDialog.show();
235 | } catch (Exception e) {
236 | e.printStackTrace();
237 | iSplash.onShow();
238 | }
239 | }
240 | }catch (Exception e) {
241 | e.printStackTrace();
242 | iSplash.onShow();
243 | }
244 | }
245 | @SuppressWarnings("deprecation")
246 | private void showGUI(){
247 | try {
248 | showSplash(new ISplash() {
249 | @Override
250 | public void onShow() {
251 | LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
252 | guiDialog = new Dialog(getApplicationContext(), android.R.style.Theme_Black);
253 | guiDialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
254 | guiDialog.getWindow().setType(new RequestDialog().getWindowType());
255 | guiDialog.setContentView(inflater.inflate(R.layout.layout_main, null));
256 | initGUI(guiDialog);
257 | mainHandler = new Handler(getApplicationContext().getMainLooper());
258 | if(splashDialog != null && splashDialog.isShowing()) {
259 | splashDialog.cancel();
260 | }
261 | guiDialog.show();
262 | settings = new SettingsPageInflater(getApplicationContext(), null).getSettings();
263 | new LProxy(getApplicationContext(), Integer.parseInt(settings.get(0)),
264 | Integer.parseInt(settings.get(1)), Integer.parseInt(settings.get(2)),
265 | Integer.parseInt(settings.get(3)))
266 | .start(new LProxy.IProxyStatus() {
267 | @Override
268 | public void onReceive(HttpRequest httpRequest, String blacklist) {
269 | httpReqs.add(new HTTPReq(httpRequest.getUri(),
270 | httpRequest.getMethod().name(),
271 | httpRequest.getProtocolVersion().text(),
272 | httpRequest.getDecoderResult(),
273 | getTime(), new FilteredResponse(Integer.parseInt(settings.get(2))).isBlacklisted(httpRequest.getUri(),
274 | blacklist.split("[" + SqliteDBHelper.SPLIT_CHAR + "]"))));
275 | final ArrayList tmpHttpReqs = new ArrayList<>(httpReqs);
276 | Collections.reverse(tmpHttpReqs);
277 | Runnable setAdapterRunnable = new Runnable() {
278 | @Override
279 | public void run() {
280 | try {
281 | mRecyclerView.setAdapter(new RequestAdapter(getApplicationContext(), tmpHttpReqs, new RequestAdapter.OnItemClickListener() {
282 | @Override
283 | public void onItemClick(HTTPReq item, int i) {
284 | mainPageInflater.onDetailDialogItemClick(item, blacklistPageInflater, viewPager, pageIDs.BlackList.getID());
285 | }
286 | }));
287 | if(txvMainPageMsg != null && txvMainPageMsg.getVisibility() == View.VISIBLE)
288 | txvMainPageMsg.setVisibility(View.GONE);
289 | } catch (Exception e) {
290 | e.printStackTrace();
291 | }
292 | }
293 | };
294 | mainHandler.post(setAdapterRunnable);
295 | }
296 |
297 | @Override
298 | public void onNotify(NotificationHandler notificationHandler1, HttpProxyServer httpProxyServer1) {
299 | notificationHandler = notificationHandler1;
300 | httpProxyServer = httpProxyServer1;
301 | }
302 |
303 | @Override
304 | public void onError(Exception e) {
305 | Log.d(getString(R.string.app_name), e.toString());
306 | }
307 |
308 | private String getTime() {
309 | DateFormat df = new SimpleDateFormat("{HH:mm:ss}", Locale.getDefault());
310 | return df.format(Calendar.getInstance().getTime());
311 | }
312 | });
313 |
314 | }
315 | });
316 | }catch (Exception e){
317 | e.printStackTrace();
318 | Log.d(getString(R.string.app_name), "GUI start error.");
319 | stopSelf();
320 | }
321 | }
322 | @SuppressWarnings("deprecation")
323 | private void onViewPager_select(int position){
324 | String pageNumHTML = "";
325 | int color;
326 | for(int i = 0; i < LayoutPagerAdapter.PagerEnum.values().length; i++){
327 | if(i == position)
328 | color = ContextCompat.getColor(getApplicationContext(), android.R.color.white);
329 | else
330 | color = ContextCompat.getColor(getApplicationContext(), R.color.color2dark);
331 | pageNumHTML += "" + String.valueOf(i+1) + " " + "";
332 | }
333 | txvNum.setText(Html.fromHtml(pageNumHTML));
334 | }
335 | private void showGuiDialog(){
336 | try{
337 | if(guiDialog != null && !guiDialog.isShowing()){
338 | guiDialog.show();
339 | }else if (guiDialog == null){
340 | cancelNotifications();
341 | showGUI();
342 | }
343 | }catch (Exception e){
344 | e.printStackTrace();
345 | }
346 | }
347 | private void cancelNotifications(){
348 | try {
349 | notificationHandler.getNotificationManager().cancelAll();
350 | }catch (Exception e){
351 | e.printStackTrace();
352 | }
353 | }
354 | private void stopProxy(){
355 | if(guiDialog != null && guiDialog.isShowing()) {
356 | guiDialog.cancel();
357 | guiDialog = null;
358 | }
359 | try{
360 | httpProxyServer.stop();
361 | }catch (Exception e){
362 | e.printStackTrace();
363 | }
364 | try{
365 | httpProxyServer.abort();
366 | }catch (Exception e){
367 | e.printStackTrace();
368 | }
369 | }
370 | @Override
371 | public void onDestroy() {
372 | super.onDestroy();
373 | cancelNotifications();
374 | stopProxy();
375 | }
376 | }
377 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/k3pler_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/orhun/k3pler/6a2dcc7c45110d7428dd9597fce4aab4d6011801/app/src/main/res/drawable/k3pler_logo.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/k3plerbg3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/orhun/k3pler/6a2dcc7c45110d7428dd9597fce4aab4d6011801/app/src/main/res/drawable/k3plerbg3.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/k3plerlogo2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/orhun/k3pler/6a2dcc7c45110d7428dd9597fce4aab4d6011801/app/src/main/res/drawable/k3plerlogo2.png
--------------------------------------------------------------------------------
/app/src/main/res/layout/layout_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
19 |
28 |
39 |
40 |
46 |
47 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/layout_pager_about.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
13 |
17 |
23 |
36 |
47 |
60 |
71 |
82 |
83 |
96 |
109 |
110 |
111 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/layout_pager_blacklist.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
17 |
23 |
35 |
36 |
49 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/layout_pager_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
17 |
22 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/layout_pager_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
14 |
17 |
28 |
40 |
51 |
52 |
64 |
77 |
88 |
89 |
102 |
115 |
126 |
127 |
139 |
151 |
162 |
163 |
175 |
187 |
198 |
199 |
212 |
223 |
224 |
237 |
248 |
261 |
262 |
263 |
264 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/layout_req_detail.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
13 |
19 |
29 |
41 |
53 |
65 |
77 |
89 |
101 |
113 |
125 |
133 |
145 |
146 |
147 |
148 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/layout_splash.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/list_blacklist.xml:
--------------------------------------------------------------------------------
1 |
6 |
19 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/list_requests.xml:
--------------------------------------------------------------------------------
1 |
7 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/k3pler_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/orhun/k3pler/6a2dcc7c45110d7428dd9597fce4aab4d6011801/app/src/main/res/mipmap-hdpi/k3pler_logo.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/k3pler_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/orhun/k3pler/6a2dcc7c45110d7428dd9597fce4aab4d6011801/app/src/main/res/mipmap-mdpi/k3pler_logo.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/k3pler_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/orhun/k3pler/6a2dcc7c45110d7428dd9597fce4aab4d6011801/app/src/main/res/mipmap-xhdpi/k3pler_logo.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/k3pler_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/orhun/k3pler/6a2dcc7c45110d7428dd9597fce4aab4d6011801/app/src/main/res/mipmap-xxhdpi/k3pler_logo.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/k3pler_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/orhun/k3pler/6a2dcc7c45110d7428dd9597fce4aab4d6011801/app/src/main/res/mipmap-xxxhdpi/k3pler_logo.png
--------------------------------------------------------------------------------
/app/src/main/res/values-tr/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | k3pler
3 | k3pler proxy
4 | Lokal Proxy üzerinden bağlantı engelleyici & ağ paketi izleyici
5 | Bağlantı engelleyici & ağ paketi izleyici
6 | karaliste
7 | ayarlar
8 | hakkında
9 | Proxy bağlandı
10 | Durdur
11 | Arayüz
12 | Karalisteye eklendi.
13 | Kaldır
14 | Temizle
15 | Düzenle
16 | Ayar Değiştir
17 | Değişikler için uygulamayı yeniden başlatınız.
18 | OK
19 | IS_NOTIFICATION
20 | Karalisteye Ekle
21 | Zaman:
22 | Sonuç:
23 | Protokol:
24 | Metot:
25 | Adres
26 | Proxy Port:
27 | Max. Buffer:
28 | 10x1024x1024
29 | Eşleşme Türü:
30 | Karaliste HTTP Cevabı:
31 | Başlangıç Ekranı:
32 | Tamamı
33 | Kelime
34 | Göster
35 | Gösterme
36 | 8090
37 | 1
38 | BAD GATEWAY
39 | BAD REQUEST
40 | FORBIDDEN
41 | NOT FOUND
42 | Proxy üzerinden bağlanılacak port numarası
43 | Maksimum response boyutu (byte)
44 | Tamamı: Adresin tamamı karalistede ise engelle\nKelime: Karalistedeki kelimeler adreste bulunuyor ise engelle
45 | Engellenen adrese gönderilecek HTTP response türü
46 | Uygulama açıldığında başlangıç ekranını göster
47 | Proxy Konfigürasyonu (WIFI)
48 | 1. WIFI Ayarları\n2. Bağlanılan ağ özellikleri\n3. Ağ Yapısını Değiştir -> Gelişmiş\n4. Proxy ayarlarını değiştir\n(örn: localhost:8090)
49 | Proxy Konfigürasyonu (Mobil Ağ)
50 | 1. Mobil Ağlar\n2. Erişim Noktası Adları\n3. Kullanılan APN\'i seçin\n4. Proxy ayarlarını değiştir\n(örn: localhost:8090)
51 | Ağ trafiği bekleniyor…
52 | [Karaliste boş]
53 | github.com/orhun
54 | Açık Kaynak Lisanslar
55 | Android v7 RecyclerView Library
56 | littleproxy 1.1.2
57 | ~ J. Kepler
58 | https://en.wikipedia.org/wiki/Johannes_Kepler
59 |
60 |
--------------------------------------------------------------------------------
/app/src/main/res/values-tr/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #C5CEE1
4 | #0FC41B
5 | #0DAC64
6 | #FFE641
7 | #F9DB13
8 | #C08A05
9 | #101010
10 | #666666
11 | #888888
12 | #80444444
13 | #80222222
14 | #90222222
15 |
16 | #cfdfda
17 | #202240
18 |
19 | #653BB5
20 | #4C1CAA
21 | #7F5AC7
22 | #A385DC
23 |
24 | #3F52B5
25 | #2137AA
26 | #5E6FC7
27 | #8895DC
28 |
29 | #595565
30 | #343FAC
31 | #7079d3
32 | #4F5ABD
33 | #40b1b3c9
34 |
35 |
36 | #3087A8
37 | #12769C
38 | #4F9FBD
39 | #7CBDD6
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | k3pler
3 | k3pler proxy
4 | Network connection blocker and packet analyzer built on top of local HTTP proxy.
5 | Network connection blocker and packet analyzer
6 | blacklist
7 | settings
8 | about
9 | Proxy running
10 | Stop Proxy
11 | Show GUI
12 | Added to blacklist.
13 | Remove
14 | Clear Blacklist
15 | Edit
16 | Edit Setting
17 | Restart App to see the changes
18 | OK
19 | IS_NOTIFICATION
20 | Add to Blacklist
21 | Time:
22 | Result:
23 | Protocol:
24 | Method:
25 | Request addr
26 | Proxy Port:
27 | Max. Buffer:
28 | 10x1024x1024
29 | Match Type:
30 | Blacklist Response:
31 | Splash Screen:
32 | Full
33 | Keyword
34 | Show
35 | Don\'t Show
36 | 8090
37 | 1
38 | BAD GATEWAY
39 | BAD REQUEST
40 | FORBIDDEN
41 | NOT FOUND
42 | Local Proxy port for connection
43 | Maximum response buffer size in bytes
44 | Full: Block if request URI \'equals\' blacklist item\nKeyword: Block if request URI \'contains\' blacklist item
45 | Response status which will be sent to blocked address
46 | Show splash screen when app starts
47 | Configuring Proxy (WIFI)
48 | 1. WIFI Settings\n2. Long tap on connected network\n3. Modify Network -> Advanced Options\n4. Set manual proxy to k3pler proxy settings\n(e.g: localhost:8090)
49 | Configuring Proxy (Mobile Network)
50 | 1. Mobile Network Settings\n2. Access Point Names\n3. Tap on used APN\n4. Set proxy/port to k3pler settings\n(e.g: localhost:8090)
51 | Waiting for network traffic…
52 | [Empty blacklist]
53 | github.com/orhun
54 | Open Source Licences
55 | Android v7 RecyclerView Library
56 | littleproxy 1.1.2
57 | ~ J. Kepler
58 | https://en.wikipedia.org/wiki/Johannes_Kepler
59 |
60 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | maven {
7 | url 'https://maven.google.com/'
8 | name 'Google'
9 | }
10 | }
11 | dependencies {
12 | classpath 'com.android.tools.build:gradle:3.1.3'
13 | }
14 | }
15 |
16 | allprojects {
17 | repositories {
18 | jcenter()
19 | maven {
20 | url "https://maven.google.com"
21 | }
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/etc/k3pler_logo3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/orhun/k3pler/6a2dcc7c45110d7428dd9597fce4aab4d6011801/etc/k3pler_logo3.png
--------------------------------------------------------------------------------
/etc/k3plerbg3_splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/orhun/k3pler/6a2dcc7c45110d7428dd9597fce4aab4d6011801/etc/k3plerbg3_splash.png
--------------------------------------------------------------------------------
/etc/page1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/orhun/k3pler/6a2dcc7c45110d7428dd9597fce4aab4d6011801/etc/page1.png
--------------------------------------------------------------------------------
/etc/page2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/orhun/k3pler/6a2dcc7c45110d7428dd9597fce4aab4d6011801/etc/page2.png
--------------------------------------------------------------------------------
/etc/page3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/orhun/k3pler/6a2dcc7c45110d7428dd9597fce4aab4d6011801/etc/page3.png
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu Sep 12 17:33:03 GMT+02:00 2019
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
7 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------