├── LICENSE
├── Pipfile
├── Pipfile.lock
├── README.md
├── eMENU.py
├── eNAS.py
├── eNB_LOCAL.py
├── images
├── application.png
├── eNB.png
├── eNB_open5gs_menu.png
├── open5gs_eNB_setup.png
└── trace_4g_open5gs_eNB.pcapng
└── requirements.txt
/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 |
--------------------------------------------------------------------------------
/Pipfile:
--------------------------------------------------------------------------------
1 | [[source]]
2 | url = "https://pypi.python.org/simple"
3 | verify_ssl = true
4 | name = "pypi"
5 |
6 | [packages]
7 | pycryptodome = "*"
8 | requests = "*"
9 | smartcard = "*"
10 | pycrate = "*"
11 | pysctp = "*"
12 |
13 | [dev-packages]
14 |
15 | [requires]
16 | python_version = "3.9"
17 |
18 | [packages.card]
19 | git = "https://github.com/mitshell/card.git"
20 | ref = "v0.9.0"
21 |
22 | [packages.CryptoMobile]
23 | git = "https://github.com/P1sec/CryptoMobile.git"
24 | ref = "246d494857328996385ab4e8ab469348c97334f2"
25 |
--------------------------------------------------------------------------------
/Pipfile.lock:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "hash": {
4 | "sha256": "2ffb25cd7b4238c42c03da2c3f82fa812efdc9d15b5bcd3218abb630a13b6e2f"
5 | },
6 | "pipfile-spec": 6,
7 | "requires": {
8 | "python_version": "3.9"
9 | },
10 | "sources": [
11 | {
12 | "name": "pypi",
13 | "url": "https://pypi.python.org/simple",
14 | "verify_ssl": true
15 | }
16 | ]
17 | },
18 | "default": {
19 | "btrees": {
20 | "hashes": [
21 | "sha256:03cad075c38e52e5f6662ef16ad52f0b37f849ad5d696e3d4e2da5614ce420bc",
22 | "sha256:1ea05e91842fc02b3c01e2d18667a2a3dbfcc3f902aa33d499c1bfcba9a636c8",
23 | "sha256:23af5041101143418a6b109ed184091aa9a00431b1847044ca1cd3fc968b59aa",
24 | "sha256:34862314aed96ca195766691b7bb2d89a35c376441540f84dd2af183278194e2",
25 | "sha256:34e8fd044c85356b3096dc991a5c70ae1692dcd07968fb7de9b7264f37c72626",
26 | "sha256:39026d5bee08b79eb3d83a716276a733145aa8b5aa7ec5890c5efaa6898fe057",
27 | "sha256:3a0b3642bbc36a6beebc5ccbc749fcd93ec65530f05223ae31fd0c76ab185e75",
28 | "sha256:4ee8f5880ca6be3e177a852da3ac09fac883680cce310d638e1f482a6fb4c267",
29 | "sha256:5427b3ffbce05ab8f4db4b99d3463c7700e605a3f413b38e61500cbe4b872bc5",
30 | "sha256:5c3d1f6ba10f5686552b407a6ef468015230b45fb4d6a160a9d19fedf78041cf",
31 | "sha256:670869947dcc4216c66f73fc1dc1dff6b053ef45242b925c3fd95e32f5d1604f",
32 | "sha256:69fcefa4a5542f7c736d26f9ea44baafbb4a3a6862bec981d6eac1beda60e672",
33 | "sha256:70cd7a679ef05d7b7b1f5725c28928c4328f8ff1f9f9ddada097c6a77334a92d",
34 | "sha256:7dc03f8afd98c9f64c79a9b944e6c0476b76c2d00b6d2473ac66aeedb90c3c2a",
35 | "sha256:93e1d058a60f0914c94ae623e0d747082153e0242f159b8f4bf6395fe2cc8bb8",
36 | "sha256:945cf38fc2a26d4259b0d38078654870c4f14a420843b91cc93e10ed7cec5a3d",
37 | "sha256:9e8485c6ed09477cdd0c878bf8d5a7e994200d82edb9cd7c00caede4042f8a12",
38 | "sha256:adb01cec4212739b6033c7673f0ad4cf8cdba36ebea932a32ab69b82a2987656",
39 | "sha256:b53f2798c9215b851969a1601ec806643d42f74a2ddeacbf38e2ed6aea1fb109",
40 | "sha256:b79259916631dcbd242fc3dd156c4ba0de66c1f3d936338f3aff204839a59a4a",
41 | "sha256:b8e160c6dfcd4544f74be584a70a6b442e71a19e8dadd1cd8d0b7e3cd4263bd9",
42 | "sha256:ba6aa6592bee36a45c9866424430530085ac3f7dccb5ade94206a7102539788a",
43 | "sha256:bfb2238affe98062b6a5778d709a64bde60fcaa6604c1a34f47f8b25a9ca8658",
44 | "sha256:c349a416e7e4f3d6a2858d605b9fa0b92fad268714134dd0e2f7e0b631c03eef",
45 | "sha256:c456801116444588afb84522c946b1c4ed5198deee6fbef6acc1a54a569b4f99",
46 | "sha256:cf87c185d65559b91fdf71d075b86c7ea8aa68c67cc5dc2010589e9919144cfd",
47 | "sha256:d204f55915bcce691b4e5dc1fc8926c9e0da7994a80ea70b7e42aead853fed6d",
48 | "sha256:d6ab0e3410d074d7154245d6dc6493ae86f1b50bd6080d1310ebb3ecdea5deb6",
49 | "sha256:e19147982a4e37a3fd6e5a04d054917b3a8d4f102901e75d067738151b650100",
50 | "sha256:e27a397ee41efc2d4ae337308fd6b1d82c267e25e0310ce3417ae594258d38a1",
51 | "sha256:e378707d019b522283ceea03d1f39df040d0abb668714ea5173771d1eeacbbdf",
52 | "sha256:e67b21567ef0edceabb4770009978cdb3bef5864c5a412bb060cc15207ccbf1a",
53 | "sha256:f0a6229980c39ccba644bb15e0045f3c2b6b173c9f87bb61a23d843cb389ab98",
54 | "sha256:f2249c6bcc6a749f0f846e301c9d42633c9388f8b54b6b431068a95d9cc6a07a",
55 | "sha256:f6a89ef8d31c19a1d2348d4d2df24b1596b280a93fc06855b365e3f324dfc8bb",
56 | "sha256:ff3c5a196f5bf2402f981672b850e218486d0fa6c9ebcb27e32f40c3a3cd3416"
57 | ],
58 | "version": "==4.10.0"
59 | },
60 | "card": {
61 | "git": "https://github.com/mitshell/card.git",
62 | "ref": "v0.9.0"
63 | },
64 | "certifi": {
65 | "hashes": [
66 | "sha256:84c85a9078b11105f04f3036a9482ae10e4621616db313fe045dd24743a0820d",
67 | "sha256:fe86415d55e84719d75f8b69414f6438ac3547d2078ab91b67e779ef69378412"
68 | ],
69 | "version": "==2022.6.15"
70 | },
71 | "cffi": {
72 | "hashes": [
73 | "sha256:00a9ed42e88df81ffae7a8ab6d9356b371399b91dbdf0c3cb1e84c03a13aceb5",
74 | "sha256:03425bdae262c76aad70202debd780501fabeaca237cdfddc008987c0e0f59ef",
75 | "sha256:04ed324bda3cda42b9b695d51bb7d54b680b9719cfab04227cdd1e04e5de3104",
76 | "sha256:0e2642fe3142e4cc4af0799748233ad6da94c62a8bec3a6648bf8ee68b1c7426",
77 | "sha256:173379135477dc8cac4bc58f45db08ab45d228b3363adb7af79436135d028405",
78 | "sha256:198caafb44239b60e252492445da556afafc7d1e3ab7a1fb3f0584ef6d742375",
79 | "sha256:1e74c6b51a9ed6589199c787bf5f9875612ca4a8a0785fb2d4a84429badaf22a",
80 | "sha256:2012c72d854c2d03e45d06ae57f40d78e5770d252f195b93f581acf3ba44496e",
81 | "sha256:21157295583fe8943475029ed5abdcf71eb3911894724e360acff1d61c1d54bc",
82 | "sha256:2470043b93ff09bf8fb1d46d1cb756ce6132c54826661a32d4e4d132e1977adf",
83 | "sha256:285d29981935eb726a4399badae8f0ffdff4f5050eaa6d0cfc3f64b857b77185",
84 | "sha256:30d78fbc8ebf9c92c9b7823ee18eb92f2e6ef79b45ac84db507f52fbe3ec4497",
85 | "sha256:320dab6e7cb2eacdf0e658569d2575c4dad258c0fcc794f46215e1e39f90f2c3",
86 | "sha256:33ab79603146aace82c2427da5ca6e58f2b3f2fb5da893ceac0c42218a40be35",
87 | "sha256:3548db281cd7d2561c9ad9984681c95f7b0e38881201e157833a2342c30d5e8c",
88 | "sha256:3799aecf2e17cf585d977b780ce79ff0dc9b78d799fc694221ce814c2c19db83",
89 | "sha256:39d39875251ca8f612b6f33e6b1195af86d1b3e60086068be9cc053aa4376e21",
90 | "sha256:3b926aa83d1edb5aa5b427b4053dc420ec295a08e40911296b9eb1b6170f6cca",
91 | "sha256:3bcde07039e586f91b45c88f8583ea7cf7a0770df3a1649627bf598332cb6984",
92 | "sha256:3d08afd128ddaa624a48cf2b859afef385b720bb4b43df214f85616922e6a5ac",
93 | "sha256:3eb6971dcff08619f8d91607cfc726518b6fa2a9eba42856be181c6d0d9515fd",
94 | "sha256:40f4774f5a9d4f5e344f31a32b5096977b5d48560c5592e2f3d2c4374bd543ee",
95 | "sha256:4289fc34b2f5316fbb762d75362931e351941fa95fa18789191b33fc4cf9504a",
96 | "sha256:470c103ae716238bbe698d67ad020e1db9d9dba34fa5a899b5e21577e6d52ed2",
97 | "sha256:4f2c9f67e9821cad2e5f480bc8d83b8742896f1242dba247911072d4fa94c192",
98 | "sha256:50a74364d85fd319352182ef59c5c790484a336f6db772c1a9231f1c3ed0cbd7",
99 | "sha256:54a2db7b78338edd780e7ef7f9f6c442500fb0d41a5a4ea24fff1c929d5af585",
100 | "sha256:5635bd9cb9731e6d4a1132a498dd34f764034a8ce60cef4f5319c0541159392f",
101 | "sha256:59c0b02d0a6c384d453fece7566d1c7e6b7bae4fc5874ef2ef46d56776d61c9e",
102 | "sha256:5d598b938678ebf3c67377cdd45e09d431369c3b1a5b331058c338e201f12b27",
103 | "sha256:5df2768244d19ab7f60546d0c7c63ce1581f7af8b5de3eb3004b9b6fc8a9f84b",
104 | "sha256:5ef34d190326c3b1f822a5b7a45f6c4535e2f47ed06fec77d3d799c450b2651e",
105 | "sha256:6975a3fac6bc83c4a65c9f9fcab9e47019a11d3d2cf7f3c0d03431bf145a941e",
106 | "sha256:6c9a799e985904922a4d207a94eae35c78ebae90e128f0c4e521ce339396be9d",
107 | "sha256:70df4e3b545a17496c9b3f41f5115e69a4f2e77e94e1d2a8e1070bc0c38c8a3c",
108 | "sha256:7473e861101c9e72452f9bf8acb984947aa1661a7704553a9f6e4baa5ba64415",
109 | "sha256:8102eaf27e1e448db915d08afa8b41d6c7ca7a04b7d73af6514df10a3e74bd82",
110 | "sha256:87c450779d0914f2861b8526e035c5e6da0a3199d8f1add1a665e1cbc6fc6d02",
111 | "sha256:8b7ee99e510d7b66cdb6c593f21c043c248537a32e0bedf02e01e9553a172314",
112 | "sha256:91fc98adde3d7881af9b59ed0294046f3806221863722ba7d8d120c575314325",
113 | "sha256:94411f22c3985acaec6f83c6df553f2dbe17b698cc7f8ae751ff2237d96b9e3c",
114 | "sha256:98d85c6a2bef81588d9227dde12db8a7f47f639f4a17c9ae08e773aa9c697bf3",
115 | "sha256:9ad5db27f9cabae298d151c85cf2bad1d359a1b9c686a275df03385758e2f914",
116 | "sha256:a0b71b1b8fbf2b96e41c4d990244165e2c9be83d54962a9a1d118fd8657d2045",
117 | "sha256:a0f100c8912c114ff53e1202d0078b425bee3649ae34d7b070e9697f93c5d52d",
118 | "sha256:a591fe9e525846e4d154205572a029f653ada1a78b93697f3b5a8f1f2bc055b9",
119 | "sha256:a5c84c68147988265e60416b57fc83425a78058853509c1b0629c180094904a5",
120 | "sha256:a66d3508133af6e8548451b25058d5812812ec3798c886bf38ed24a98216fab2",
121 | "sha256:a8c4917bd7ad33e8eb21e9a5bbba979b49d9a97acb3a803092cbc1133e20343c",
122 | "sha256:b3bbeb01c2b273cca1e1e0c5df57f12dce9a4dd331b4fa1635b8bec26350bde3",
123 | "sha256:cba9d6b9a7d64d4bd46167096fc9d2f835e25d7e4c121fb2ddfc6528fb0413b2",
124 | "sha256:cc4d65aeeaa04136a12677d3dd0b1c0c94dc43abac5860ab33cceb42b801c1e8",
125 | "sha256:ce4bcc037df4fc5e3d184794f27bdaab018943698f4ca31630bc7f84a7b69c6d",
126 | "sha256:cec7d9412a9102bdc577382c3929b337320c4c4c4849f2c5cdd14d7368c5562d",
127 | "sha256:d400bfb9a37b1351253cb402671cea7e89bdecc294e8016a707f6d1d8ac934f9",
128 | "sha256:d61f4695e6c866a23a21acab0509af1cdfd2c013cf256bbf5b6b5e2695827162",
129 | "sha256:db0fbb9c62743ce59a9ff687eb5f4afbe77e5e8403d6697f7446e5f609976f76",
130 | "sha256:dd86c085fae2efd48ac91dd7ccffcfc0571387fe1193d33b6394db7ef31fe2a4",
131 | "sha256:e00b098126fd45523dd056d2efba6c5a63b71ffe9f2bbe1a4fe1716e1d0c331e",
132 | "sha256:e229a521186c75c8ad9490854fd8bbdd9a0c9aa3a524326b55be83b54d4e0ad9",
133 | "sha256:e263d77ee3dd201c3a142934a086a4450861778baaeeb45db4591ef65550b0a6",
134 | "sha256:ed9cb427ba5504c1dc15ede7d516b84757c3e3d7868ccc85121d9310d27eed0b",
135 | "sha256:fa6693661a4c91757f4412306191b6dc88c1703f780c8234035eac011922bc01",
136 | "sha256:fcd131dd944808b5bdb38e6f5b53013c5aa4f334c5cad0c72742f6eba4b73db0"
137 | ],
138 | "markers": "platform_python_implementation == 'CPython'",
139 | "version": "==1.15.1"
140 | },
141 | "charset-normalizer": {
142 | "hashes": [
143 | "sha256:5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845",
144 | "sha256:83e9a75d1911279afd89352c68b45348559d1fc0506b054b346651b5e7fee29f"
145 | ],
146 | "version": "==2.1.1"
147 | },
148 | "cryptomobile": {
149 | "git": "https://github.com/P1sec/CryptoMobile.git",
150 | "ref": "246d494857328996385ab4e8ab469348c97334f2"
151 | },
152 | "idna": {
153 | "hashes": [
154 | "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff",
155 | "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"
156 | ],
157 | "version": "==3.3"
158 | },
159 | "persistent": {
160 | "hashes": [
161 | "sha256:0d6934976b239727caa516adec22e943abb9db1c9fef66440e5e373989f6e30a",
162 | "sha256:1adb850f642be7e5d21814ec23c6d6299315c90274baef3d5940e4346644951c",
163 | "sha256:1f2e4fda36e7754faa64a8b81a1f8885813c59815a38f9f41560a7f5ef795514",
164 | "sha256:2d1bbf615e067bb8bc35c418265b6b5a573cd27e3f37cf2695a319c8fb85a1b5",
165 | "sha256:2d71550ac2aa601b96fc1dd64c87b97c9d54c9ca81aedcad6776e00c8f80011d",
166 | "sha256:3277daca96db74b32ae24ca418bcb8f6d2480fe5794a4c67832a16ffc2e74a31",
167 | "sha256:3baa155d2a686ecea1ce9ac2b60fc44967b132beee49150bd079925e3b3c46d8",
168 | "sha256:4701b31d81c1042265725af390450e9d916ad74b9c178b7010053853591e0c6a",
169 | "sha256:4f78de2ee1e7469f8c9347a5ca724a068cae52935d5b0b4401b1683b5cea2097",
170 | "sha256:5392d9b1451d6a1da2b59e27e10eb45d0ffbcecfe0e14aae4b98b8b2547a7286",
171 | "sha256:57fc77be949ad6bedf077c456b58d31b98690512567e9e676c6171972bb0da50",
172 | "sha256:5be31f034709ab6833b7bd9c3b4835664f0971a2e8ff403380d861f7899dde79",
173 | "sha256:5c9d55dd9bf238beb3565ab0b274552c2c4121921580464988586ed09b5ecbcb",
174 | "sha256:6413db4d784846436c4a00d9a66b3c6bce3f45cad2eb3247d39ced8e41b942b7",
175 | "sha256:6af3b724b0993f9a72e2a644837bc0dc8c44526a6c17ecd32bf60672e37b8608",
176 | "sha256:6ffc7e720cf124a45b890e655d80b644f8c12b1fb97da7df78c5278ef28b2d8b",
177 | "sha256:7333f96f7f140fdd223bb3e0966ac0ce76321865c37ff11ac45f561fea302f29",
178 | "sha256:73a55f1b09f48c99adc87e208db7e115a201ad1e0bd2de328587e993c85c6bd2",
179 | "sha256:78be12da25a20c8ce053065ec8a24837a2f445fa5dd53b284e26dafa066585d2",
180 | "sha256:7996d05b539352d7b612aa350a1f024f7e32ab24e23f8b5ebac275e43669bdb1",
181 | "sha256:7e2650c619ad8acc67caad27f0caa856b3c3aaa474edf4cd9d39fd5b9389ae2b",
182 | "sha256:8bf0f183637508e4e588a64c61bd8be2e34086a37687f733c7cad1e6dbe7bc2c",
183 | "sha256:90e3de2bd66df303b1fa90086ef82d8cf9eef87fe3503da03e29f2f62a2f8884",
184 | "sha256:9ec24d5a704fee4bd5aca12bb0f17e05f1386bd8d3903657a89c50214afb547e",
185 | "sha256:a9618487416445243094d87dcc865c32a2c6039020afb51cdeca63e6fcb3c624",
186 | "sha256:b3a5de9f4760245f6c6000763f2f8e8cabbb06ea5bc804ea1f219b17c4526dee",
187 | "sha256:b9c25ea6920f322344b25fc1beca24fb04944fc28b7157b36f42cdb9c5ce3846",
188 | "sha256:c1405c4928b9399d25b98097fa1a4694d172b2af7c9afb67d7ae12709ea48bf3",
189 | "sha256:c45e88c8f9daffdddd033d840b3ea89fd4b954c262f010b19d9fc64dce6c16bf",
190 | "sha256:dfceb7f4feb738fe8a60c22a47ee402e2a4ae213f6808329c0902ce3c19ade2b",
191 | "sha256:e0b2a16319686fd1b5bbb385e3b83a3224568d13cb0a3417536279194d41b119",
192 | "sha256:e5ff4a80e781190debbc940d3e2736439a224fbe9fb8694f4eba164bb9510f84",
193 | "sha256:e612bfa55cbbb30a4bfd566e56844087edd525783f8c15edd530bc3236e68f34",
194 | "sha256:ec0f6774a9b668ef842ef564cc1871caeef1b3735a7566ad8e47a81a1d98e940",
195 | "sha256:ec8983c0253a44a43360462312d6d810762edeb96a392da031db20763ac404ca",
196 | "sha256:f37b157dcc13a64f97d14520b9a892dfc14385d034409f6c735bc9ee4ab7607e"
197 | ],
198 | "version": "==4.9.0"
199 | },
200 | "pycparser": {
201 | "hashes": [
202 | "sha256:8ee45429555515e1f6b185e78100aea234072576aa43ab53aefcae078162fca9",
203 | "sha256:e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206"
204 | ],
205 | "version": "==2.21"
206 | },
207 | "pycrate": {
208 | "hashes": [
209 | "sha256:581bd8b564fdcb82779db87acfcd09d4b6e0b1a452d3823be6c3c0b409b3df85",
210 | "sha256:59f09331890a389a6b98412f19f4fb021c5a75a35ab07bf5ba0d1e299a0967af"
211 | ],
212 | "index": "pypi",
213 | "version": "==0.5.5"
214 | },
215 | "pycryptodome": {
216 | "hashes": [
217 | "sha256:045d75527241d17e6ef13636d845a12e54660aa82e823b3b3341bcf5af03fa79",
218 | "sha256:0926f7cc3735033061ef3cf27ed16faad6544b14666410727b31fea85a5b16eb",
219 | "sha256:092a26e78b73f2530b8bd6b3898e7453ab2f36e42fd85097d705d6aba2ec3e5e",
220 | "sha256:1b22bcd9ec55e9c74927f6b1f69843cb256fb5a465088ce62837f793d9ffea88",
221 | "sha256:2aa55aae81f935a08d5a3c2042eb81741a43e044bd8a81ea7239448ad751f763",
222 | "sha256:2ea63d46157386c5053cfebcdd9bd8e0c8b7b0ac4a0507a027f5174929403884",
223 | "sha256:2ec709b0a58b539a4f9d33fb8508264c3678d7edb33a68b8906ba914f71e8c13",
224 | "sha256:2ffd8b31561455453ca9f62cb4c24e6b8d119d6d531087af5f14b64bee2c23e6",
225 | "sha256:4b52cb18b0ad46087caeb37a15e08040f3b4c2d444d58371b6f5d786d95534c2",
226 | "sha256:4c3ccad74eeb7b001f3538643c4225eac398c77d617ebb3e57571a897943c667",
227 | "sha256:5099c9ca345b2f252f0c28e96904643153bae9258647585e5e6f649bb7a1844a",
228 | "sha256:57f565acd2f0cf6fb3e1ba553d0cb1f33405ec1f9c5ded9b9a0a5320f2c0bd3d",
229 | "sha256:60b4faae330c3624cc5a546ba9cfd7b8273995a15de94ee4538130d74953ec2e",
230 | "sha256:7c9ed8aa31c146bef65d89a1b655f5f4eab5e1120f55fc297713c89c9e56ff0b",
231 | "sha256:7e3a8f6ee405b3bd1c4da371b93c31f7027944b2bcce0697022801db93120d83",
232 | "sha256:9135dddad504592bcc18b0d2d95ce86c3a5ea87ec6447ef25cfedea12d6018b8",
233 | "sha256:9c772c485b27967514d0df1458b56875f4b6d025566bf27399d0c239ff1b369f",
234 | "sha256:9eaadc058106344a566dc51d3d3a758ab07f8edde013712bc8d22032a86b264f",
235 | "sha256:9ee40e2168f1348ae476676a2e938ca80a2f57b14a249d8fe0d3cdf803e5a676",
236 | "sha256:a8f06611e691c2ce45ca09bbf983e2ff2f8f4f87313609d80c125aff9fad6e7f",
237 | "sha256:b9c5b1a1977491533dfd31e01550ee36ae0249d78aae7f632590db833a5012b8",
238 | "sha256:b9cc96e274b253e47ad33ae1fccc36ea386f5251a823ccb50593a935db47fdd2",
239 | "sha256:c3640deff4197fa064295aaac10ab49a0d55ef3d6a54ae1499c40d646655c89f",
240 | "sha256:c77126899c4b9c9827ddf50565e93955cb3996813c18900c16b2ea0474e130e9",
241 | "sha256:d2a39a66057ab191e5c27211a7daf8f0737f23acbf6b3562b25a62df65ffcb7b",
242 | "sha256:e244ab85c422260de91cda6379e8e986405b4f13dc97d2876497178707f87fc1",
243 | "sha256:ecaaef2d21b365d9c5ca8427ffc10cebed9d9102749fd502218c23cb9a05feb5",
244 | "sha256:fd2184aae6ee2a944aaa49113e6f5787cdc5e4db1eb8edb1aea914bd75f33a0c",
245 | "sha256:ff287bcba9fbeb4f1cccc1f2e90a08d691480735a611ee83c80a7d74ad72b9d9",
246 | "sha256:ff7ae90e36c1715a54446e7872b76102baa5c63aa980917f4aa45e8c78d1a3ec"
247 | ],
248 | "index": "pypi",
249 | "version": "==3.15.0"
250 | },
251 | "pysctp": {
252 | "hashes": [
253 | "sha256:fadb1cf7ed8bef4595ecc8963012a58a8f7d4bf69bc94a6942ed2908196e7fdf"
254 | ],
255 | "index": "pypi",
256 | "version": "==0.7.1"
257 | },
258 | "requests": {
259 | "hashes": [
260 | "sha256:7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983",
261 | "sha256:8fefa2a1a1365bf5520aac41836fbee479da67864514bdb821f31ce07ce65349"
262 | ],
263 | "index": "pypi",
264 | "version": "==2.28.1"
265 | },
266 | "six": {
267 | "hashes": [
268 | "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926",
269 | "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"
270 | ],
271 | "version": "==1.16.0"
272 | },
273 | "smartcard": {
274 | "hashes": [
275 | "sha256:4379b48ccfbd4f78fd5df4e73420aaa79ef6ff1e042d6299a3f71621c3b3d0ad"
276 | ],
277 | "index": "pypi",
278 | "version": "==0.3"
279 | },
280 | "transaction": {
281 | "hashes": [
282 | "sha256:0c15ef0b7ff3518357ceea75722a30d974c3f85e11aa5cec5d5a2b6a40cfcf68",
283 | "sha256:2329a6e6b82d1d8d4de9267ea6ee790532c375e5911d3c7633a234e94a4a0a9e"
284 | ],
285 | "version": "==3.0.1"
286 | },
287 | "urllib3": {
288 | "hashes": [
289 | "sha256:3fa96cf423e6987997fc326ae8df396db2a8b7c667747d47ddd8ecba91f4a74e",
290 | "sha256:b930dd878d5a8afb066a637fbb35144fe7901e3b209d1cd4f524bd0e9deee997"
291 | ],
292 | "version": "==1.26.12"
293 | },
294 | "zc.lockfile": {
295 | "hashes": [
296 | "sha256:307ad78227e48be260e64896ec8886edc7eae22d8ec53e4d528ab5537a83203b",
297 | "sha256:cc33599b549f0c8a248cb72f3bf32d77712de1ff7ee8814312eb6456b42c015f"
298 | ],
299 | "version": "==2.0"
300 | },
301 | "zconfig": {
302 | "hashes": [
303 | "sha256:a28e95a0ae335795747eccad35b2cb708f37d44c7f325e2acb201e98330b16e5",
304 | "sha256:d36cebe34b49fb2a9123472c8a22dbbf25837f33d31300d391403810cb1557d7"
305 | ],
306 | "version": "==3.6.0"
307 | },
308 | "zodb": {
309 | "hashes": [
310 | "sha256:dc4cb46a5e30753c2e57cc20b1411b4356b3041fba9683531cedfdb1e922ab4a",
311 | "sha256:fa40bbc05ecda1ec2435cd0c6dd02a13b7698460558a4604366f6a0a68401cd3"
312 | ],
313 | "version": "==5.7.0"
314 | },
315 | "zodbpickle": {
316 | "hashes": [
317 | "sha256:015051e78a30f45b62ef04c7374885b7d9ba5a66f2ce8e105aa2f756319e11d8",
318 | "sha256:03d88090a7e3a33918f35c6ee17ad516f68185074ee148d31d4ec2a7338751a0",
319 | "sha256:12a0372ee78fa21cb6acc305cbd34a34343dec0cade69711363db4f947c3eff8",
320 | "sha256:186d0c33932b658dc5a66901d6b5a1ae27db74bc6a0349a2625dede809e6d6f8",
321 | "sha256:2ba915a59175b82ea2aea8504b9fa1bcb2f2a282659180ed31711fb338a34c73",
322 | "sha256:2f87ac8e13416691965835113158dd165afa9bffbce82b7b909b7eeee7c21d2e",
323 | "sha256:328f8e2bbf963b0a350d08be3ba522e57ad7a26b71484f7de44c5210359f9e54",
324 | "sha256:3b077e2b7f6e4542183047a437c9530fb5a1cde2a8e032993ba62bee59e0b7b3",
325 | "sha256:4122d7542b98bf42233eda622c7890cf785aa56273e67bc702fd14dc5cad1423",
326 | "sha256:43d0186d777a9b4c18129d2aeabe8f6dd23a276d7e50352be3b24e0eae55ca97",
327 | "sha256:46c397b540fbf3249fce61c4f344a04b3d3ff9fa38669e6cd4adb6cea24c5f7f",
328 | "sha256:48346313c463d5a62901dd4cff8c77708e4b36839de9b05d4b8231baeb47670a",
329 | "sha256:4c6e50f3e395911b5ea425bf5c2139a43f2d746f8c76324e13e584f632b753b7",
330 | "sha256:568bbca7cd75e7fa0764f991618cf95423edcf111948649e8b53f16c5b68cf1d",
331 | "sha256:68483ea25f755162f0b6f13643d61b639c31232c3a197cbf6e8a7491104ee05d",
332 | "sha256:6a7e9d203c1ade34e88f7152e17b303bc1aeb716d2496d0a98e7100956b86d36",
333 | "sha256:7138a545e9250f208fd2f6f2764ce22290ea781ad385fb1a9352a3425d2dc2a7",
334 | "sha256:738a4d05cb0d6d4754e7b3be1d736aefeb74f2b2507472c1c6bd74cf2ebc070b",
335 | "sha256:82385eb1b1ba4dde9bc4c33d917182224a32ad1d4e4e599e133f273aac0df6a1",
336 | "sha256:838a8c6d37f59e2181b153887d20753ce4c9fa1c25eb0a824f227f4c22bbd65f",
337 | "sha256:87c8e7f62137554be8f4a4b16efb0d60e52abc369671e74fefb28243b04e773c",
338 | "sha256:91e9cc9e152a2d80779287452333cb21badd2f156e90d319ccd807fcc6946588",
339 | "sha256:9d7abbf9c5e788f3a672ff675c942a653df2eb8a106e893313aa33e3c431ae99",
340 | "sha256:a1d993035869b632f557c4e6b9d121ea2bd422041e61ac1033cfef579cdb4102",
341 | "sha256:a3212474e353d0c9481a5bdced46e430d93fd08fac13e45811b14a3059d96cc3",
342 | "sha256:b72231e0eb3986dc4965a89d11f9113ef9234b981904069ed8240fee1161fe59",
343 | "sha256:bb4b42c55ee031e5fca8e0d04afaa679383efc13a04f94a4580227f9774d973e",
344 | "sha256:d4b780bd44f868a19e8cf8051356cd4e41f70eb01f312797a773a425dbdf072f",
345 | "sha256:d684a7abebe0b0da69328f88761e6774f1c1feefe0f5663a5ca72a9cd722b84a",
346 | "sha256:e256764073b27046fefcd8a0c793b6dc3d9743ec0f18b24a419864d36a87d753",
347 | "sha256:e4cb5c719705e8bb1e8eee4aa24e2071a3094ecf2783d87407ab822f166da3a2",
348 | "sha256:e903e9a063b54571eab3601895bddfdb3aea7385a29dc1559c4a5dde5968fa6d",
349 | "sha256:f0cdd5d29ce768a487bf8d1cf4f81b26d79692e98e8f3438251458fba2026575",
350 | "sha256:f3f0ce06be972f501ba7be7d8303c7216eded882b41d9659839f7a28c5399493",
351 | "sha256:f68a049356fb703e6fc6e15410a737d11a7079a1ff2aeddceb8e5992a4f6be21",
352 | "sha256:fbad54a0e35c04def8a2161f5e0ba308d2db00ea295861b827cf234bc5ae1da2"
353 | ],
354 | "version": "==2.3"
355 | },
356 | "zope.interface": {
357 | "hashes": [
358 | "sha256:08f9636e99a9d5410181ba0729e0408d3d8748026ea938f3b970a0249daa8192",
359 | "sha256:0b465ae0962d49c68aa9733ba92a001b2a0933c317780435f00be7ecb959c702",
360 | "sha256:0cba8477e300d64a11a9789ed40ee8932b59f9ee05f85276dbb4b59acee5dd09",
361 | "sha256:0cee5187b60ed26d56eb2960136288ce91bcf61e2a9405660d271d1f122a69a4",
362 | "sha256:0ea1d73b7c9dcbc5080bb8aaffb776f1c68e807767069b9ccdd06f27a161914a",
363 | "sha256:0f91b5b948686659a8e28b728ff5e74b1be6bf40cb04704453617e5f1e945ef3",
364 | "sha256:15e7d1f7a6ee16572e21e3576d2012b2778cbacf75eb4b7400be37455f5ca8bf",
365 | "sha256:17776ecd3a1fdd2b2cd5373e5ef8b307162f581c693575ec62e7c5399d80794c",
366 | "sha256:194d0bcb1374ac3e1e023961610dc8f2c78a0f5f634d0c737691e215569e640d",
367 | "sha256:1c0e316c9add0db48a5b703833881351444398b04111188069a26a61cfb4df78",
368 | "sha256:205e40ccde0f37496904572035deea747390a8b7dc65146d30b96e2dd1359a83",
369 | "sha256:273f158fabc5ea33cbc936da0ab3d4ba80ede5351babc4f577d768e057651531",
370 | "sha256:2876246527c91e101184f63ccd1d716ec9c46519cc5f3d5375a3351c46467c46",
371 | "sha256:2c98384b254b37ce50eddd55db8d381a5c53b4c10ee66e1e7fe749824f894021",
372 | "sha256:2e5a26f16503be6c826abca904e45f1a44ff275fdb7e9d1b75c10671c26f8b94",
373 | "sha256:334701327f37c47fa628fc8b8d28c7d7730ce7daaf4bda1efb741679c2b087fc",
374 | "sha256:3748fac0d0f6a304e674955ab1365d515993b3a0a865e16a11ec9d86fb307f63",
375 | "sha256:3c02411a3b62668200910090a0dff17c0b25aaa36145082a5a6adf08fa281e54",
376 | "sha256:3dd4952748521205697bc2802e4afac5ed4b02909bb799ba1fe239f77fd4e117",
377 | "sha256:3f24df7124c323fceb53ff6168da70dbfbae1442b4f3da439cd441681f54fe25",
378 | "sha256:469e2407e0fe9880ac690a3666f03eb4c3c444411a5a5fddfdabc5d184a79f05",
379 | "sha256:4de4bc9b6d35c5af65b454d3e9bc98c50eb3960d5a3762c9438df57427134b8e",
380 | "sha256:5208ebd5152e040640518a77827bdfcc73773a15a33d6644015b763b9c9febc1",
381 | "sha256:52de7fc6c21b419078008f697fd4103dbc763288b1406b4562554bd47514c004",
382 | "sha256:5bb3489b4558e49ad2c5118137cfeaf59434f9737fa9c5deefc72d22c23822e2",
383 | "sha256:5dba5f530fec3f0988d83b78cc591b58c0b6eb8431a85edd1569a0539a8a5a0e",
384 | "sha256:5dd9ca406499444f4c8299f803d4a14edf7890ecc595c8b1c7115c2342cadc5f",
385 | "sha256:5f931a1c21dfa7a9c573ec1f50a31135ccce84e32507c54e1ea404894c5eb96f",
386 | "sha256:63b82bb63de7c821428d513607e84c6d97d58afd1fe2eb645030bdc185440120",
387 | "sha256:66c0061c91b3b9cf542131148ef7ecbecb2690d48d1612ec386de9d36766058f",
388 | "sha256:6f0c02cbb9691b7c91d5009108f975f8ffeab5dff8f26d62e21c493060eff2a1",
389 | "sha256:71aace0c42d53abe6fc7f726c5d3b60d90f3c5c055a447950ad6ea9cec2e37d9",
390 | "sha256:7d97a4306898b05404a0dcdc32d9709b7d8832c0c542b861d9a826301719794e",
391 | "sha256:7df1e1c05304f26faa49fa752a8c690126cf98b40b91d54e6e9cc3b7d6ffe8b7",
392 | "sha256:8270252effc60b9642b423189a2fe90eb6b59e87cbee54549db3f5562ff8d1b8",
393 | "sha256:867a5ad16892bf20e6c4ea2aab1971f45645ff3102ad29bd84c86027fa99997b",
394 | "sha256:877473e675fdcc113c138813a5dd440da0769a2d81f4d86614e5d62b69497155",
395 | "sha256:8892f89999ffd992208754851e5a052f6b5db70a1e3f7d54b17c5211e37a98c7",
396 | "sha256:9a9845c4c6bb56e508651f005c4aeb0404e518c6f000d5a1123ab077ab769f5c",
397 | "sha256:a1e6e96217a0f72e2b8629e271e1b280c6fa3fe6e59fa8f6701bec14e3354325",
398 | "sha256:a8156e6a7f5e2a0ff0c5b21d6bcb45145efece1909efcbbbf48c56f8da68221d",
399 | "sha256:a9506a7e80bcf6eacfff7f804c0ad5350c8c95b9010e4356a4b36f5322f09abb",
400 | "sha256:af310ec8335016b5e52cae60cda4a4f2a60a788cbb949a4fbea13d441aa5a09e",
401 | "sha256:b0297b1e05fd128d26cc2460c810d42e205d16d76799526dfa8c8ccd50e74959",
402 | "sha256:bf68f4b2b6683e52bec69273562df15af352e5ed25d1b6641e7efddc5951d1a7",
403 | "sha256:d0c1bc2fa9a7285719e5678584f6b92572a5b639d0e471bb8d4b650a1a910920",
404 | "sha256:d4d9d6c1a455d4babd320203b918ccc7fcbefe308615c521062bc2ba1aa4d26e",
405 | "sha256:db1fa631737dab9fa0b37f3979d8d2631e348c3b4e8325d6873c2541d0ae5a48",
406 | "sha256:dd93ea5c0c7f3e25335ab7d22a507b1dc43976e1345508f845efc573d3d779d8",
407 | "sha256:f44e517131a98f7a76696a7b21b164bcb85291cee106a23beccce454e1f433a4",
408 | "sha256:f7ee479e96f7ee350db1cf24afa5685a5899e2b34992fb99e1f7c1b0b758d263"
409 | ],
410 | "version": "==5.4.0"
411 | }
412 | },
413 | "develop": {}
414 | }
415 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # eNB s1 Emulator
2 |
3 |
4 | This is an eNB emulator application done in python3 to interact with MME (S1AP) and SGW (S1-U).
5 | This application can be used to perform and simulate several EMM and ESM procedures, including user plane traffic.
6 | This application was tested with real MMEs (lab environment).
7 |
8 | 
9 |
10 | ## Installation
11 |
12 | To begin with you will need Python3 / Pip installed and a few other libraries / dependencies.
13 |
14 | On a Debian/Ubuntu systems you can install with:
15 | ```apt-get install -y python3-pip libsctp-dev swig python3-pyscard git net-tools```
16 |
17 | Now we can clone the repository with:
18 |
19 | ```
20 | git clone https://github.com/fasferraz/eNB
21 | cd eNB/
22 | ```
23 |
24 | Finally we will need to install all of the Python packages needed to run the tool.
25 |
26 | We can install all these packages using Pip3 with:
27 |
28 | ```sudo pip3 install -r requirements.txt```
29 |
30 | ## Authentication
31 |
32 | We have 3 options for authenticating our simulated subscribers to the network:
33 | - Using a physical SIM connected via a smart card reader (The modem needs to support the AT commands AT+CSIM. You can define the ttyUSBx to use in the options (-u).)
34 | - Statically setting Ki & OP/OPc keys set as parameters when starting the program (See option ```--ki=KI```, ```--op=OP``` and ```--opc=OPc``` )
35 | - Via an external USIM Server with a physical SIM connected controlled over HTTP (see https://github.com/fasferraz/USIM-https-server)
36 |
37 | Note: If none of these options is defined, a default KASME and XRES are used (check corresponding variables inside *session_dict_initialization* function).
38 |
39 | ## Usage
40 |
41 | Many variables needed for SA1P and NAS are defined inside the *session_dict_initialization* function.
42 | You can change them to meet your own needs.
43 |
44 | When you call the script these are the options available:
45 |
46 | ```
47 | python3 eNB_LOCAL.py -h
48 | Usage: eNB_LOCAL.py [options]
49 |
50 | Options:
51 | -h, --help show this help message and exit
52 | -i ENB_IP, --ip=ENB_IP
53 | eNB Local IP Address
54 | -m MME_IP, --mme=MME_IP
55 | MME IP Address
56 | -g GATEWAY_IP_ADDRESS, --gateway_ip_address=GATEWAY_IP_ADDRESS
57 | gateway IP address
58 | -u SERIAL_INTERFACE, --usb_device=SERIAL_INTERFACE
59 | modem port (i.e. COMX, or /dev/ttyUSBX), smartcard
60 | reader index (0, 1, 2, ...), or server for https
61 | -I IMSI, --imsi=IMSI IMSI (15 digits)
62 | -E IMEI, --imei=IMEI IMEI-SV (16 digits)
63 | -K KI, --ki=KI ki for Milenage (if not using option -u)
64 | -P OP, --op=OP op for Milenage (if not using option -u)
65 | -C OPC, --opc=OPC opc for Milenage (if not using option -u)
66 | -o PLMN, --operator=PLMN
67 | Operator MCC+MNC
68 |
69 | ```
70 |
71 | Note: Gateway IP Address (option -g) is needed when the MME or SGW are not in the local LAN. With user plane activated, the default route points to a tunnel interface, so this Gateway IP Address is needed so that MME address and SGW address are also reachable (using /32 routes) using this IP as next-hop address. In case of multiple interfaces, this IP address must be in the same network as the source interface used for eNB address (option -i).
72 |
73 |
74 | Example usage fo eNB address - 172.16.168.130, and MME address - 172.16.168.8 (eNB and MME in the same LAN), and ttyUSB2:
75 |
76 | ```python3 eNB_LOCAL.py -i 172.16.168.130 -m 172.16.168.8 -u /dev/ttyUSB2```
77 |
78 |
79 | This is the application user interface, where we can see the current options and procedures supported:
80 |
81 | 
82 |
83 | This application implements S1-U, so after an successful Attach with PDN Connectivity activation, you can use the laptop applications (browser, terminal, etc...) to send/receive traffic over the GTP-U connection towards the SGW using the session IP address, using a tunnel interface.
84 |
85 | In case the session is a NB-IoT session you can also send the user plane over NAS including Non-IP Data Delivery (NIDD).
86 |
87 | The basic flow could be for example, option 15 - to bring up the s1 interface, and then option 20 - to perform attach.
88 |
89 | ## Functionality
90 |
91 | The application supports currently the following options:
92 |
93 | - S1 Setup type: LTE, NB-IoT, or both
94 | - Mobile Identity Type: IMSI or GUTI
95 | - Attach PDN: Default APN, or Specific APN
96 | - Session Type: 4G, 5G or NB-IoT
97 | - Session Sub-Type: No PSM and No eDRX, PSM, eDRX or both PSM and eDRX
98 | - PDN Type ipv4, ipv6, ipv4v6 or Non-IP
99 | - Control Plane Service Request with Radio Bearer or without Radio Bearer
100 | - Attach Type: EPS Attach, Combined EPS/IMSI Attach or Emergency Attach
101 | - TAU Type: TA Updating, Combined TA/LA Updating or Combined TA/LA Updating with IMSI Attach
102 | - Process Paging: Enabled or Disabled
103 | - SMS Update type: Additional Update Type SMS Only: False or True
104 | - eNB Cell and TAC can change
105 | - P-CSCF Restoration Support capability
106 |
107 | In terms of procedures, the application supports the following ones:
108 |
109 | - S1 Setup Request
110 | - S1 Reset
111 | - Attach
112 | - Detach
113 | - TAU
114 | - TAU Periodic
115 | - Service Request
116 | - UE Context Release
117 | - Send SMS (a predefined one)
118 | - Control Plane Service Request
119 | - E-RAB Modification Indication (5G)
120 | - Secondary RAT Data Usage Report (5G)
121 | - PDN Connectivity
122 | - PDN Disconnect
123 | - Activate/Deactivate GTP-U for Control Plane
124 | - Activate/Deactivate Data over NAS
125 | - Set/Send Non-IP Packet
126 |
127 |
128 | You can also find more information in https://fabricioapps.blogspot.com/2020/07/mme-part-i-enb-emulator.html
129 |
130 | ## Dependencies
131 |
132 | I had previously done some experiments with SCTP using the native socket module from python3, but starting a ASN.1 module for S1AP from scratch was a big challenge. Fortunately I found some magnificent python modules for ASN.1 and S1AP done by P1 Security that I highly recommend:
133 |
134 | https://github.com/P1sec
135 |
136 | They have plenty of modules for almost anything related to Mobile Developments, but for my project i just used the S1AP from pycrate_asn1dir module, and CM from the CryptoMobile module (that has all the ciphering and integrity protocols needed for NAS).
137 | In order to derive the integrity and ciphering keys from KASME/CK/IK) i used another module: the Crypto.Hash (pip3 install pycryptodome) that has the HMAC and SHA256 functions needed for KDF.
138 |
139 | For serial communication towards the modem I use the pyserial module (pip3 install pyserial)
140 |
141 | For smartcard reader communication I use the smartcard module (pyscard module from https://pypi.org/project/pyscard/) and card module (from https://github.com/mitshell/card).
142 |
143 | For https request to https server I use the requests module.
144 |
145 |
146 | So in resume, these are the required external (non-standard) modules:
147 |
148 | ```
149 | from pycrate_asn1dir import S1AP
150 | from pycrate_asn1rt.utils import *
151 | from CryptoMobile.CM import *
152 | from CryptoMobile.Milenage import Milenage
153 | from Crypto.Hash import HMAC
154 | from Crypto.Hash import SHA256
155 | ```
156 |
157 | For IMSI, and authentication these are the required external (non-standard) modules:
158 |
159 | (at least one of these options should be available if we need to use real USIM)
160 |
161 | ```
162 | try:
163 | import serial
164 | except:
165 | pass
166 | try:
167 | from smartcard.System import readers
168 | from smartcard.util import toHexString,toBytes
169 | try:
170 | from card.USIM import *
171 | except:
172 | pass
173 | except:
174 | pass
175 | try:
176 | import requests
177 | requests.packages.urllib3.disable_warnings()
178 | except:
179 | pass
180 |
181 | ```
182 |
183 | For authentication the application also accepts Ki and OP/OPC for Milenage operation (usefull for testing with developments like open5gs, where the USIM parameters are defined in the HSS/UDR).
184 |
185 |
186 | ## Updated version (2023/02/19):
187 | - Support of gtp kernel (libgtpnl and modprobe gtp) for default namespace. New option -Z
188 |
189 | ## New branch added by Avmalavi that supports Multi-User!!!!
190 | Check it here: https://github.com/fasferraz/eNB/tree/multi-user
191 |
192 | ## Updated version (2023/10/30):
193 | - New option to support setting SCTP MAX SEG
194 | - New option to define UERadioCapability in hex string (useful to test UERadioCapability bigger than MTU)
195 | - New option to support a second SCTP connection to another MME, so that you can establish session in one MME, and perform other procedures like TAU in the other, etc...
196 | - New option to set GUTI by CLI. This may be usueful to test S10 procedures (GTP or DNS)
197 |
198 | ```
199 | python3 eNB_LOCAL.py -h
200 | Usage: eNB_LOCAL.py [options]
201 |
202 | Options:
203 | -h, --help show this help message and exit
204 | -i ENB_IP, --ip=ENB_IP
205 | eNB Local IP Address
206 | -m MME_IP, --mme=MME_IP
207 | MME IP Address
208 | -g GATEWAY_IP_ADDRESS, --gateway_ip_address=GATEWAY_IP_ADDRESS
209 | gateway IP address
210 | -u SERIAL_INTERFACE, --usb_device=SERIAL_INTERFACE
211 | modem port (i.e. COMX, or /dev/ttyUSBX), smartcard
212 | reader index (0, 1, 2, ...), or server for https
213 | -I IMSI, --imsi=IMSI IMSI (15 digits)
214 | -E IMEI, --imei=IMEI IMEI-SV (16 digits)
215 | -K KI, --ki=KI ki for Milenage (if not using option -u)
216 | -P OP, --op=OP op for Milenage (if not using option -u)
217 | -C OPC, --opc=OPC opc for Milenage (if not using option -u)
218 | -o PLMN, --operator=PLMN
219 | Operator MCC+MNC
220 | --tac1=TAC1 1st tracking area code
221 | --tac2=TAC2 2nd tracking area code
222 | -Z, --gtp-kernel Use GTP Kernel. Needs libgtpnl
223 | -S MAXSEG, --maxseg=MAXSEG
224 | SCTP MAX_SEG (>463 bytes)
225 | --ue-radio-capability=UERADIOCAPABILITY
226 | UERadioCapability in hex string
227 | -G GUTI, --guti=GUTI GUTI in format ---
229 | --mme-2=MME_2_IP 2nd MME IP Address
230 | ```
231 |
--------------------------------------------------------------------------------
/eMENU.py:
--------------------------------------------------------------------------------
1 | # Import the modules needed to run the script.
2 | import sys, os
3 | import datetime
4 | from eNB_LOCAL import *
5 | import random
6 |
7 | # Main definition - constants
8 | menu_actions = {}
9 |
10 |
11 | SEPARATOR_HORIZONTAL = '='
12 | SEPARATOR_VERTICAL = '|'
13 | MENU_WIDTH = 45
14 | LOG_WIDTH = 110
15 | LOG_SIZE = 100
16 |
17 |
18 | # =======================
19 | # MENUS FUNCTIONS
20 | # =======================
21 |
22 | # Main menu
23 |
24 | menu_list = [ ' 0. Show current settings', \
25 | ' 1. Set S1 Setup type', \
26 | ' 2. Set Attach Mobile Identity',\
27 | ' 3. Set Attach PDN', \
28 | ' 4. Set Session type', \
29 | ' 5. Set NBIOT PSM/eDRX', \
30 | ' 6. Set PDN type', \
31 | ' 7. Set CPSR type', \
32 | ' 8. Set Attach type', \
33 | ' 9. Set TAU type (for option 22)', \
34 | ' 10. Set Process Paging', \
35 | ' 11. Set SMS (AdditionalUpdateType)', \
36 | ' 12. Set eNB-CellID/TAC', \
37 | ' 13. Set P-CSCF Restoration Support', \
38 | ' 14. Set Delivery Indication', \
39 | ' ', \
40 | ' 15. S1 Setup', \
41 | ' 16. S1 Reset', \
42 | ' ', \
43 | ' 20. Attach', \
44 | ' 21. Detach', \
45 | ' 22. TAU', \
46 | ' 23. TAU Periodic', \
47 | ' 24. Service Request', \
48 | ' 25. Release UE Context', \
49 | ' 26. Send SMS', \
50 | ' 30. Control Plane Service Request',\
51 | ' 35. E-RAB ModificationIndication (5G)',\
52 | ' 36. Secondary RAT Data Usage Report (5G)',\
53 | ' 37. HandoverRequired (SRVCC)',\
54 | ' ', \
55 | ' 40. PDN Connectivity', \
56 | ' 41. PDN Disconnect', \
57 | ' ', \
58 | ' 50. Activate GTP-U/IP over ControlPlane', \
59 | ' 51. Deactivate GTP-U/IP over ControlPlane', \
60 | ' ', \
61 | ' 60. Set Non-IP Packet to Send', \
62 | ' 61. Send Non-IP Packet', \
63 | ' ', \
64 | ' 80. Set MME to use', \
65 | ' 99. Clear Log', \
66 | ' Q. Quit' ]
67 |
68 |
69 | class bcolors:
70 | HEADER = '\033[95m'
71 | OKBLUE = '\033[94m'
72 | OKGREEN = '\033[92m'
73 | WARNING = '\033[93m'
74 | FAIL = '\033[91m'
75 | ENDC = '\033[0m'
76 | BOLD = '\033[1m'
77 | UNDERLINE = '\033[4m'
78 |
79 | def print_menu(log):
80 |
81 | MENU_SIZE = len(menu_list) + 1
82 | log = log[-MENU_SIZE+1:]
83 | os.system('clear')
84 |
85 | title = []
86 | title.append(" _ _____ __ __")
87 | title.append(bcolors.HEADER + "=============== " + bcolors.ENDC + "___ / |/ / _ ) ___ __ _ __ __/ /__ _/ /____ ____ ")
88 | title.append(bcolors.HEADER + "==============" + bcolors.ENDC + " / -_) / _ | / -_) ' \/ // / / _ `/ __/ _ \/ __/ ")
89 | title.append(bcolors.HEADER + "==============" + bcolors.ENDC +" \__/_/|_/____/ \__/_/_/_/\_,_/_/\_,_/\__/\___/_/ (by fasferraz@gmail.com v1.0) ")
90 |
91 | print(title[0])
92 | for i in range(1,len(title)):
93 | print(title[i] + bcolors.HEADER + SEPARATOR_HORIZONTAL*(12+MENU_WIDTH+LOG_WIDTH-len(title[i])) + bcolors.ENDC)
94 |
95 |
96 | print(bcolors.HEADER + SEPARATOR_HORIZONTAL*(3+ MENU_WIDTH + LOG_WIDTH) + bcolors.ENDC)
97 | print(bcolors.HEADER + SEPARATOR_VERTICAL + ' '*MENU_WIDTH + SEPARATOR_VERTICAL + ' '*LOG_WIDTH + SEPARATOR_VERTICAL + bcolors.ENDC)
98 | print(bcolors.HEADER + SEPARATOR_VERTICAL + bcolors.WARNING + bcolors.BOLD + ' Menu:' + ' '*(MENU_WIDTH-len(' Menu:')) + bcolors.HEADER + SEPARATOR_VERTICAL + bcolors.WARNING + bcolors.BOLD + ' Log:' + ' '*(LOG_WIDTH-len(' Log:')) + bcolors.HEADER + SEPARATOR_VERTICAL + bcolors.ENDC)
99 | print(bcolors.HEADER+ SEPARATOR_VERTICAL + ' '*MENU_WIDTH + SEPARATOR_VERTICAL + ' '*LOG_WIDTH + SEPARATOR_VERTICAL + bcolors.ENDC)
100 | for i in range(MENU_SIZE):
101 | if i < len(menu_list) and i IPv4, 2-> IPv6, 3-> IPv4v6, 5-> Non-IP): " + str( session_dict['PDP-TYPE']))
146 | if session_dict['CPSR-TYPE'] == 0: # NO-RADIO-BEARER
147 | session_dict = print_log(session_dict, "CPSR Type: No Radio Bearer")
148 | elif session_dict['CPSR-TYPE'] == 8: # RADIO-BEARER
149 | session_dict = print_log(session_dict, "CPSR Type: Radio Bearer")
150 | if session_dict['ATTACH-TYPE'] == 2:
151 | session_dict = print_log(session_dict, "Attach Type: Combined EPS/IMSI Attach")
152 | elif session_dict['ATTACH-TYPE'] == 1:
153 | session_dict = print_log(session_dict, "Attach Type: EPS Attach")
154 | elif session_dict['ATTACH-TYPE'] == 6:
155 | session_dict = print_log(session_dict, "Attach Type: EPS Emergency Attach")
156 | if session_dict['PROCESS-PAGING'] == False:
157 | session_dict = print_log(session_dict, "Process Paging: False")
158 | elif session_dict['PROCESS-PAGING'] == True:
159 | session_dict = print_log(session_dict, "Process Paging: True")
160 | if session_dict['TAU-TYPE'] == 1:
161 | session_dict = print_log(session_dict, "TAU Type: Combined TA/LA Updating")
162 | elif session_dict['TAU-TYPE'] == 2:
163 | session_dict = print_log(session_dict, "TAU Type: Combined TA/LA Updating with IMSI Attach")
164 | elif session_dict['TAU-TYPE'] == 0:
165 | session_dict = print_log(session_dict, "TAU Type: TA Updating")
166 | if session_dict['SMS-UPDATE-TYPE'] == False:
167 | session_dict = print_log(session_dict, "AdditionalUPdateType: SMS Only: False")
168 | elif session_dict['SMS-UPDATE-TYPE'] == True:
169 | session_dict = print_log(session_dict, "AdditionalUPdateType: SMS Only: True")
170 |
171 |
172 | elif msg == "1\n":
173 | if session_dict['S1-TYPE'] == "4G":
174 | session_dict['S1-TYPE'] = "NBIOT"
175 | session_dict = print_log(session_dict, "S1 Setup type: NBIOT")
176 | elif session_dict['S1-TYPE'] == "NBIOT":
177 | session_dict['S1-TYPE'] = "BOTH"
178 | session_dict = print_log(session_dict, "S1 Setup type: BOTH")
179 | elif session_dict['S1-TYPE'] == "BOTH":
180 | session_dict['S1-TYPE'] = "4G"
181 | session_dict = print_log(session_dict, "S1 Setup type: 4G")
182 |
183 | elif msg == "2\n":
184 | if session_dict['MOBILE-IDENTITY-TYPE'] == "IMSI":
185 | session_dict['MOBILE-IDENTITY-TYPE'] = "GUTI"
186 | session_dict['MOBILE-IDENTITY'] = session_dict['ENCODED-GUTI']
187 | session_dict = print_log(session_dict, "Attach Mobile Identity: GUTI")
188 | elif session_dict['MOBILE-IDENTITY-TYPE'] == "GUTI":
189 | session_dict['MOBILE-IDENTITY-TYPE'] = "IMEI"
190 | session_dict['MOBILE-IDENTITY'] = session_dict['ENCODED-IMEI']
191 | session_dict = print_log(session_dict, "Attach Mobile Identity: IMEI")
192 | elif session_dict['MOBILE-IDENTITY-TYPE'] == "IMEI":
193 | session_dict['MOBILE-IDENTITY-TYPE'] = "IMSI"
194 | session_dict['MOBILE-IDENTITY'] = session_dict['ENCODED-IMSI']
195 | session_dict = print_log(session_dict, "Attach Mobile Identity: IMSI")
196 |
197 |
198 |
199 | elif msg == "3\n": #attach type, default or with apn
200 | if session_dict['ATTACH-PDN'] == None:
201 | session_dict['ATTACH-PDN'] = 1
202 | session_dict = print_log(session_dict, "Attach PDN: " + session_dict['APN'])
203 | elif session_dict['ATTACH-PDN'] == 1:
204 | session_dict['ATTACH-PDN'] = None
205 | session_dict = print_log(session_dict, "Attach PDN: Default")
206 |
207 | elif msg == "4\n":
208 | if session_dict['SESSION-TYPE'] == "4G":
209 | session_dict['SESSION-TYPE'] = "NBIOT"
210 | session_dict['SESSION-TYPE-TUN'] = 2
211 | session_dict = print_log(session_dict, "Session Type: NBIOT")
212 | elif session_dict['SESSION-TYPE'] == "NBIOT":
213 | session_dict['SESSION-TYPE'] = "5G"
214 | session_dict['SESSION-TYPE-TUN'] = 1
215 | session_dict = print_log(session_dict, "Session Type: 5G")
216 | elif session_dict['SESSION-TYPE'] == "5G":
217 | session_dict['SESSION-TYPE'] = "4G"
218 | session_dict['SESSION-TYPE-TUN'] = 1
219 | session_dict = print_log(session_dict, "Session Type: 4G")
220 |
221 | elif msg == "5\n":
222 | if session_dict['NBIOT-SESSION-TYPE'] == "NONE":
223 | session_dict['NBIOT-SESSION-TYPE'] = "PSM"
224 | session_dict = print_log(session_dict, "PSM/eDRX: PSM Only")
225 | session_dict['SESSION-SESSION-TYPE'] = session_dict['NBIOT-SESSION-TYPE']
226 | elif session_dict['NBIOT-SESSION-TYPE'] == "PSM":
227 | session_dict['NBIOT-SESSION-TYPE'] = "EDRX"
228 | session_dict = print_log(session_dict, "PSM/eDRX: eDRX Only")
229 | session_dict['SESSION-SESSION-TYPE'] = session_dict['NBIOT-SESSION-TYPE']
230 | elif session_dict['NBIOT-SESSION-TYPE'] == "EDRX":
231 | session_dict['NBIOT-SESSION-TYPE'] = "BOTH"
232 | session_dict = print_log(session_dict, "PSM/eDRX: PSM + eDRX")
233 | session_dict['SESSION-SESSION-TYPE'] = session_dict['NBIOT-SESSION-TYPE']
234 | elif session_dict['NBIOT-SESSION-TYPE'] == "BOTH":
235 | session_dict['NBIOT-SESSION-TYPE'] = "NONE"
236 | session_dict = print_log(session_dict, "PSM/eDRX: None")
237 | session_dict['SESSION-SESSION-TYPE'] = session_dict['NBIOT-SESSION-TYPE']
238 |
239 | elif msg == "6\n":
240 | if session_dict['PDP-TYPE'] == 3:
241 | session_dict['PDP-TYPE'] = 5
242 | elif session_dict['PDP-TYPE'] == 5:
243 | session_dict['PDP-TYPE'] = 1
244 | else:
245 | session_dict['PDP-TYPE'] += 1
246 | session_dict = print_log(session_dict, "PDP Type (1-> IPv4, 2-> IPv6, 3-> IPv4v6, 5-> Non-IP): " + str( session_dict['PDP-TYPE']))
247 |
248 | elif msg == "7\n":
249 | if session_dict['CPSR-TYPE'] == 0: # NO-RADIO-BEARER
250 | session_dict['CPSR-TYPE'] = 8 # RADIO-BEARER
251 | session_dict = print_log(session_dict, "CPSR Type: Radio Bearer")
252 | elif session_dict['CPSR-TYPE'] == 8: # RADIO-BEARER
253 | session_dict['CPSR-TYPE'] = 0 # NO-RADIO-BEARER
254 | session_dict = print_log(session_dict, "CPSR Type: No Radio Bearer")
255 |
256 | elif msg == "8\n":
257 | if session_dict['ATTACH-TYPE'] == 1:
258 | session_dict['ATTACH-TYPE'] = 2
259 | session_dict = print_log(session_dict, "Attach Type: Combined EPS/IMSI Attach")
260 | elif session_dict['ATTACH-TYPE'] == 2:
261 | session_dict['ATTACH-TYPE'] = 6
262 | session_dict = print_log(session_dict, "Attach Type: EPS Emergency Attach")
263 | elif session_dict['ATTACH-TYPE'] == 6:
264 | session_dict['ATTACH-TYPE'] = 1
265 | session_dict = print_log(session_dict, "Attach Type: EPS Attach")
266 |
267 |
268 | elif msg == "9\n":
269 | if session_dict['TAU-TYPE'] == 0:
270 | session_dict['TAU-TYPE'] = 1
271 | session_dict = print_log(session_dict, "TAU Type: Combined TA/LA Updating")
272 | elif session_dict['TAU-TYPE'] == 1:
273 | session_dict['TAU-TYPE'] = 2
274 | session_dict = print_log(session_dict, "TAU Type: Combined TA/LA Updating with IMSI Attach")
275 | elif session_dict['TAU-TYPE'] == 2:
276 | session_dict['TAU-TYPE'] = 0
277 | session_dict = print_log(session_dict, "TAU Type: TA Updating")
278 |
279 | elif msg == "10\n":
280 | if session_dict['PROCESS-PAGING'] == True:
281 | session_dict['PROCESS-PAGING'] = False
282 | session_dict = print_log(session_dict, "Process Paging: False")
283 | elif session_dict['PROCESS-PAGING'] == False:
284 | session_dict['PROCESS-PAGING'] = True
285 | session_dict = print_log(session_dict, "Process Paging: True")
286 |
287 | elif msg == "11\n":
288 | if session_dict['SMS-UPDATE-TYPE'] == True:
289 | session_dict['SMS-UPDATE-TYPE'] = False
290 | session_dict = print_log(session_dict, "AdditionalUPdateType: SMS Only: False")
291 | elif session_dict['SMS-UPDATE-TYPE'] == False:
292 | session_dict['SMS-UPDATE-TYPE'] = True
293 | session_dict = print_log(session_dict, "AdditionalUPdateType: SMS Only: True")
294 |
295 | elif msg == "12\n":
296 | if session_dict['ENB-CELLID'] == 1000000:
297 | session_dict['ENB-CELLID'] = 2000000
298 | session_dict['ENB-TAC'] = session_dict['ENB-TAC2']
299 | session_dict = print_log(session_dict, "eNB CellID: 2000000")
300 | elif session_dict['ENB-CELLID'] == 2000000:
301 | session_dict['ENB-CELLID'] = 1000000
302 | session_dict['ENB-TAC'] = session_dict['ENB-TAC1']
303 | session_dict = print_log(session_dict, "eNB CellID: 1000000")
304 |
305 | elif msg == "13\n":
306 | if session_dict['PCSCF-RESTORATION'] == True:
307 | session_dict['PCSCF-RESTORATION'] = False
308 | session_dict = print_log(session_dict, "P-CSCF Restoration Support: False")
309 | elif session_dict['PCSCF-RESTORATION'] == False:
310 | session_dict['PCSCF-RESTORATION'] = True
311 | session_dict = print_log(session_dict, "P-CSCF Restoration Support: True")
312 |
313 | elif msg == "14\n":
314 | if session_dict['NAS-DELIVERY-INDICATION'] == 0:
315 | session_dict['NAS-DELIVERY-INDICATION'] = 1
316 | session_dict = print_log(session_dict, "Send NAS Delivery")
317 | elif session_dict['NAS-DELIVERY-INDICATION'] == 1:
318 | session_dict['NAS-DELIVERY-INDICATION'] = 2
319 | session_dict = print_log(session_dict, "Send NAS Non-Delivery")
320 | elif session_dict['NAS-DELIVERY-INDICATION'] == 2:
321 | session_dict['NAS-DELIVERY-INDICATION'] = 0
322 | session_dict = print_log(session_dict, "Do not send NAS Delivery/Non-Delivery")
323 |
324 | elif msg == "15\n":
325 | PDU.set_val(S1SetupRequest(session_dict))
326 | message = PDU.to_aper()
327 | client = set_stream(client, 0)
328 | bytes_sent = client.send(message)
329 |
330 | elif msg == "16\n":
331 |
332 | PDU.set_val(Reset(session_dict))
333 | message = PDU.to_aper()
334 | client = set_stream(client, 0)
335 | bytes_sent = client.send(message)
336 |
337 | elif msg == "19\n":
338 | if session_dict['STATE'] >0:
339 |
340 | session_dict['NAS-ENC'] = nas_attach_request(
341 | (session_dict['SESSION-TYPE'],session_dict['SESSION-SESSION-TYPE']),
342 | session_dict['ATTACH-PDN'],
343 | session_dict['MOBILE-IDENTITY'],
344 | session_dict['PDP-TYPE'],
345 | session_dict['ATTACH-TYPE'],
346 | session_dict['TMSI'],
347 | session_dict['LAI'],
348 | session_dict['SMS-UPDATE-TYPE'],
349 | session_dict['PCSCF-RESTORATION'],
350 | session_dict['PDN-CONNECTIVITY-REQUEST-TYPE'],
351 | session_dict['NAS-KEY-SET-IDENTIFIER']
352 | )
353 |
354 | session_dict['UP-COUNT'] += 1
355 | session_dict['DIR'] = 0
356 | mac_bytes = nas_hash(session_dict)
357 | session_dict['NAS'] = nas_security_protected_nas_message(1,mac_bytes,bytes([session_dict['UP-COUNT']%256]),session_dict['NAS-ENC'])
358 | session_dict = print_log(session_dict, "NAS: sending AttachRequest")
359 |
360 | session_dict['ENB-UE-S1AP-ID'] = random.randrange(10000)
361 | PDU.set_val(InitialUEMessage(session_dict))
362 | message = PDU.to_aper()
363 | client = set_stream(client, 1)
364 | bytes_sent = client.send(message)
365 |
366 |
367 | elif msg == "20\n":
368 | if session_dict['STATE'] >0:
369 | session_dict['NAS'] = nas_attach_request(
370 | (session_dict['SESSION-TYPE'],session_dict['SESSION-SESSION-TYPE']),
371 | session_dict['ATTACH-PDN'],
372 | session_dict['MOBILE-IDENTITY'],
373 | session_dict['PDP-TYPE'],
374 | session_dict['ATTACH-TYPE'],
375 | session_dict['TMSI'],
376 | session_dict['LAI'],
377 | session_dict['SMS-UPDATE-TYPE'],
378 | session_dict['PCSCF-RESTORATION'],
379 | session_dict['PDN-CONNECTIVITY-REQUEST-TYPE']
380 | )
381 | session_dict['SQN'] = 0
382 | session_dict['ENB-UE-S1AP-ID'] = random.randrange(10000)
383 | PDU.set_val(InitialUEMessage(session_dict))
384 | message = PDU.to_aper()
385 | client = set_stream(client, 1)
386 | bytes_sent = client.send(message)
387 |
388 |
389 |
390 | elif msg == "21\n":
391 | #start list
392 | if session_dict['STATE'] >1:
393 | session_dict = ProcessUplinkNAS('detach request', session_dict)
394 | if session_dict['MME-UE-S1AP-ID'] > 0:
395 | PDU.set_val(UplinkNASTransport(session_dict))
396 | else:
397 | session_dict['ENB-UE-S1AP-ID'] = random.randrange(10000)
398 | PDU.set_val(InitialUEMessage(session_dict))
399 | message = PDU.to_aper()
400 | client = set_stream(client, 1)
401 | bytes_sent = client.send(message)
402 |
403 | else:
404 | session_dict = print_log(session_dict, "NAS: Unable to send DetachRequest. State = 0")
405 |
406 |
407 | elif msg == "22\n":
408 | if session_dict['STATE'] >1:
409 | session_dict['ENB-UE-S1AP-ID'] = random.randrange(10000)
410 | session_dict = ProcessUplinkNAS('tracking area update request', session_dict)
411 | PDU.set_val(InitialUEMessage(session_dict))
412 | message = PDU.to_aper()
413 | client = set_stream(client, 1)
414 | bytes_sent = client.send(message)
415 |
416 |
417 | elif msg == "23\n":
418 | if session_dict['STATE'] >1:
419 | session_dict['ENB-UE-S1AP-ID'] = random.randrange(10000)
420 | session_dict = ProcessUplinkNAS('tracking area update request periodic', session_dict)
421 | PDU.set_val(InitialUEMessage(session_dict))
422 | message = PDU.to_aper()
423 | client = set_stream(client, 1)
424 | bytes_sent = client.send(message)
425 |
426 |
427 |
428 | elif msg == "24\n":
429 | if session_dict['STATE'] >1:
430 | session_dict['ENB-UE-S1AP-ID'] = random.randrange(10000)
431 | session_dict = ProcessUplinkNAS('service request', session_dict)
432 | PDU.set_val(InitialUEMessage(session_dict))
433 | message = PDU.to_aper()
434 | client = set_stream(client, 1)
435 | bytes_sent = client.send(message)
436 |
437 | elif msg == "25\n":
438 | if session_dict['STATE'] >1:
439 | PDU.set_val(UEContextReleaseRequest(session_dict))
440 | message = PDU.to_aper()
441 | client = set_stream(client, 1)
442 | bytes_sent = client.send(message)
443 |
444 | elif msg == "26\n":
445 | if session_dict['STATE'] >1:
446 | session_dict = ProcessUplinkNAS('uplink nas transport', session_dict)
447 | PDU.set_val(UplinkNASTransport(session_dict))
448 | message = PDU.to_aper()
449 | client = set_stream(client, 1)
450 | bytes_sent = client.send(message)
451 |
452 | elif msg == "30\n":
453 | if session_dict['STATE'] >1:
454 | session_dict['ENB-UE-S1AP-ID'] = random.randrange(10000)
455 | session_dict = ProcessUplinkNAS('control plane service request', session_dict)
456 | PDU.set_val(InitialUEMessage(session_dict))
457 | message = PDU.to_aper()
458 | client = set_stream(client, 1)
459 | bytes_sent = client.send(message)
460 |
461 |
462 | elif msg == "35\n":
463 | if session_dict['STATE'] >1 and session_dict['SESSION-TYPE'] == "5G":
464 |
465 | PDU.set_val(ERABModificationIndication(session_dict))
466 | message = PDU.to_aper()
467 | client = set_stream(client, 1)
468 | bytes_sent = client.send(message)
469 |
470 | elif msg == "36\n":
471 | if session_dict['STATE'] >1 and session_dict['SESSION-TYPE'] == "5G":
472 |
473 | PDU.set_val(SecondaryRATDataUsageReport(session_dict))
474 | message = PDU.to_aper()
475 | client = set_stream(client, 1)
476 | bytes_sent = client.send(message)
477 |
478 | elif msg == "37\n":
479 | if session_dict['STATE'] >1:
480 |
481 | PDU.set_val(HandoverPreparation(session_dict))
482 | message = PDU.to_aper()
483 | client = set_stream(client, 1)
484 | bytes_sent = client.send(message)
485 |
486 |
487 | elif msg == "40\n":
488 | if session_dict['STATE'] >1:
489 | if session_dict['MME-UE-S1AP-ID'] > 0:
490 | session_dict = ProcessUplinkNAS('pdn connectivity request', session_dict)
491 | PDU.set_val(UplinkNASTransport(session_dict))
492 | message = PDU.to_aper()
493 | client = set_stream(client, 1)
494 | bytes_sent = client.send(message)
495 | else:
496 | session_dict = print_log(session_dict, "NAS: Unable to send PDNConnectivityRequest. No S1. Send ServiceRequest first.")
497 | else:
498 | session_dict = print_log(session_dict, "NAS: Unable to send PDNConnectivityRequest. State < 2")
499 |
500 |
501 | elif msg == "41\n":
502 | if session_dict['STATE'] >1:
503 | if session_dict['MME-UE-S1AP-ID'] > 0:
504 | session_dict = ProcessUplinkNAS('pdn disconnect request', session_dict)
505 | PDU.set_val(UplinkNASTransport(session_dict))
506 | message = PDU.to_aper()
507 | client = set_stream(client, 1)
508 | bytes_sent = client.send(message)
509 | else:
510 | session_dict = print_log(session_dict, "NAS: Unable to send PDNDisconnectRequest. No S1. Send ServiceRequest first.")
511 | else:
512 | session_dict = print_log(session_dict, "NAS: Unable to send PDNDisconnectRequest. State < 2")
513 |
514 | elif msg == "50\n":
515 | if session_dict['STATE'] > 1:
516 | if session_dict['GTP-U'] == b'\x02':
517 | session_dict['GTP-U'] = b'\x01'
518 | if len(session_dict['SGW-GTP-ADDRESS']) > 0:
519 | os.write(session_dict['PIPE-OUT-GTPU-ENCAPSULATE'],session_dict['GTP-U'] + session_dict['SGW-GTP-ADDRESS'][-1] + session_dict['SGW-TEID'][-1])
520 | os.write(session_dict['PIPE-OUT-GTPU-DECAPSULATE'],session_dict['GTP-U'] + session_dict['SGW-GTP-ADDRESS'][-1] + b'\x00\x00\x00' + bytes([session_dict['RAB-ID'][-1]]))
521 | if session_dict['PDN-ADDRESS-IPV4'] is not None:
522 | if session_dict['GTP-KERNEL'] == False:
523 | subprocess.call("route add -net 0.0.0.0/1 gw " + session_dict['PDN-ADDRESS-IPV4'], shell=True)
524 | subprocess.call("route add -net 128.0.0.0/1 gw " + session_dict['PDN-ADDRESS-IPV4'], shell=True)
525 | if session_dict['PDN-ADDRESS-IPV6'] is not None:
526 | if session_dict['GTP-KERNEL'] == False:
527 | subprocess.call("route -A inet6 add ::/1 dev tun" + str(session_dict['SESSION-TYPE-TUN']) , shell=True)
528 | subprocess.call("route -A inet6 add 8000::/1 dev tun" + str(session_dict['SESSION-TYPE-TUN']) , shell=True)
529 | if session_dict['GATEWAY'] is not None and len(session_dict['SGW-GTP-ADDRESS']) > 0:
530 | subprocess.call("route add " + socket.inet_ntoa(session_dict['SGW-GTP-ADDRESS'][-1]) + "/32 gw " + session_dict['GATEWAY'], shell=True)
531 | if session_dict['GTP-KERNEL'] == True:
532 | subprocess.call("gtp-link add gtp1 --sgsn > /tmp/log-gtp-link1 2>&1 &", shell=True)
533 | subprocess.call("gtp-tunnel add gtp1 v1 " + str(session_dict['RAB-ID'][-1]) + " " + str(struct.unpack("!I", session_dict['SGW-TEID'][-1])[0]) + " " + session_dict['PDN-ADDRESS-IPV4'] + " " + socket.inet_ntoa(session_dict['SGW-GTP-ADDRESS'][-1]), shell=True)
534 | subprocess.call("route add -net 0.0.0.0/1 dev gtp1", shell=True)
535 | subprocess.call("route add -net 128.0.0.0/1 dev gtp1", shell=True)
536 | session_dict = print_log(session_dict, "GTP-U/IP over ControlPlane: Activation")
537 | else:
538 | session_dict = print_log(session_dict, "GTP-U/IP over ControlPlane: Already activated.")
539 | else:
540 | session_dict = print_log(session_dict, "GTP-U: Unable to Activate. State < 2")
541 |
542 | elif msg == "51\n":
543 | if session_dict['GTP-U'] == b'\x01':
544 | session_dict['GTP-U'] = b'\x02'
545 | if len(session_dict['SGW-GTP-ADDRESS']) > 0:
546 | os.write(session_dict['PIPE-OUT-GTPU-ENCAPSULATE'],session_dict['GTP-U'] + session_dict['SGW-GTP-ADDRESS'][-1] + session_dict['SGW-TEID'][-1])
547 | os.write(session_dict['PIPE-OUT-GTPU-DECAPSULATE'],session_dict['GTP-U'] + session_dict['SGW-GTP-ADDRESS'][-1] + b'\x00\x00\x00' + bytes([session_dict['RAB-ID'][-1]]))
548 | if session_dict['PDN-ADDRESS-IPV4'] is not None:
549 | if session_dict['GTP-KERNEL'] == False:
550 | subprocess.call("route del -net 0.0.0.0/1 gw " + session_dict['PDN-ADDRESS-IPV4'], shell=True)
551 | subprocess.call("route del -net 128.0.0.0/1 gw " + session_dict['PDN-ADDRESS-IPV4'], shell=True)
552 | if session_dict['PDN-ADDRESS-IPV6'] is not None:
553 | if session_dict['GTP-KERNEL'] == False:
554 | subprocess.call("route -A inet6 del ::/1 dev tun" + str(session_dict['SESSION-TYPE-TUN']) , shell=True)
555 | subprocess.call("route -A inet6 del 8000::/1 dev tun" + str(session_dict['SESSION-TYPE-TUN']) , shell=True)
556 | if session_dict['GATEWAY'] is not None and len(session_dict['SGW-GTP-ADDRESS']) > 0:
557 | subprocess.call("route del " + socket.inet_ntoa(session_dict['SGW-GTP-ADDRESS'][-1]) + "/32 gw " + session_dict['GATEWAY'], shell=True)
558 | if session_dict['GTP-KERNEL'] == True:
559 | subprocess.call("gtp-tunnel del gtp1 v1 " + str(session_dict['RAB-ID'][-1]), shell=True)
560 | subprocess.call("gtp-link del gtp1", shell=True)
561 | subprocess.call("killall gtp-tunnel", shell=True)
562 | subprocess.call("killall gtp-link", shell=True)
563 | session_dict = print_log(session_dict, "GTP-U/IP over ControlPlane: Desactivation")
564 | else:
565 | session_dict = print_log(session_dict, "GTP-U/IP over ControlPlane: Already inactive.")
566 |
567 | elif msg == "60\n":
568 | if session_dict['NON-IP-PACKET'] == 4:
569 | session_dict['NON-IP-PACKET'] = 1
570 | else:
571 | session_dict['NON-IP-PACKET'] += 1
572 | session_dict = print_log(session_dict, "Non-IP Packet number: " + str(session_dict['NON-IP-PACKET']))
573 |
574 | elif msg == "61\n":
575 | if session_dict['STATE'] > 1:
576 | session_dict['USER-DATA-CONTAINER'] = hex2bytes(session_dict['NON-IP-PACKETS'][session_dict['NON-IP-PACKET']-1])
577 | session_dict = ProcessUplinkNAS('esm data transport', session_dict)
578 |
579 | if session_dict['MME-UE-S1AP-ID'] > 0: #s1 up -
580 | PDU.set_val(UplinkNASTransport(session_dict))
581 | else:
582 | session_dict = ProcessUplinkNAS('control plane service request with esm message container', session_dict)
583 | PDU.set_val(InitialUEMessage(session_dict))
584 | message = PDU.to_aper()
585 | client = set_stream(client, 1)
586 | bytes_sent = client.send(message)
587 |
588 | elif msg == "70\n":
589 | if session_dict['PDN-CONNECTIVITY-REQUEST-TYPE'] == 1:
590 | session_dict['PDN-CONNECTIVITY-REQUEST-TYPE'] = 2
591 | session_dict = print_log(session_dict, "PDN Connectivity Request-Type: Handover")
592 | elif session_dict['PDN-CONNECTIVITY-REQUEST-TYPE'] == 2:
593 | session_dict['PDN-CONNECTIVITY-REQUEST-TYPE'] = 4
594 | session_dict = print_log(session_dict, "PDN Connectivity Request Type: Emergency")
595 | elif session_dict['PDN-CONNECTIVITY-REQUEST-TYPE'] == 4:
596 | session_dict['PDN-CONNECTIVITY-REQUEST-TYPE'] = 1
597 | session_dict = print_log(session_dict, "PDN Connectivity Request-Type: Initial Request")
598 |
599 |
600 | elif msg == "80\n":
601 | if session_dict['MME-IN-USE'] == 1:
602 | session_dict['MME-IN-USE'] = 2
603 | elif session_dict['MME-IN-USE'] == 2:
604 | session_dict['MME-IN-USE'] = 1
605 | session_dict = print_log(session_dict, "MME in use: " + str(session_dict['MME-IN-USE']))
606 |
607 | elif msg == "99\n":
608 | session_dict['LOG'] = []
609 | print_menu(session_dict['LOG'])
610 |
611 |
612 | else:
613 | print_menu(session_dict['LOG'])
614 |
615 | return PDU, client, session_dict
616 |
617 |
618 |
619 | def print_log(session_dict, log_message):
620 | data = ' ' + str(datetime.datetime.now())
621 | log_message = str(log_message)
622 | if len(data + ': ' + log_message) > LOG_WIDTH:
623 | step = LOG_WIDTH-3-len(data)
624 | for i in range(0,len(log_message),step):
625 | session_dict['LOG'].append(data +': ' + log_message[i:i+step])
626 | else:
627 | session_dict['LOG'].append(data +': ' + log_message)
628 |
629 | session_dict['LOG'] = session_dict['LOG'][-LOG_SIZE:]
630 | print_menu(session_dict['LOG'])
631 |
632 | return session_dict
633 |
634 |
635 |
--------------------------------------------------------------------------------
/eNAS.py:
--------------------------------------------------------------------------------
1 | import struct
2 | import socket
3 | from binascii import hexlify, unhexlify
4 |
5 | #BASE FUNCTION to be called from external
6 |
7 | #only used for downlink messages, so no SERVICE REQUEST message.
8 | #input: nas message
9 | def nas_decode(nas):
10 | nas_list = []
11 | if nas == None:
12 | return nas_list
13 |
14 | protocol_discriminator = nas[0] % 16
15 | nas_list.append(("protocol discriminator", protocol_discriminator))
16 | if protocol_discriminator == 7: # EMM
17 |
18 | security_header = nas[0] // 16
19 | nas_list.append(("security header", security_header))
20 | if security_header == 0: # plain nas
21 | nas_list.append(("message type", nas[1]))
22 | if len(nas)>2:
23 | emm_list = nas_decode_emm(nas[1], nas[2:])
24 | nas_list += emm_list
25 | #emm#
26 |
27 |
28 |
29 | else:
30 | nas_list.append(("message authentication code",nas[1:5]))
31 | nas_list.append(("sequence_number",nas[5]))
32 | nas_list.append(("nas message encrypted", nas[6:]))
33 |
34 | elif protocol_discriminator == 2: # ESM
35 | eps_bearer_identity = nas[0] // 16
36 | nas_list.append(("eps bearer identity", eps_bearer_identity))
37 | nas_list.append(("procedure transaction identity", nas[1]))
38 | nas_list.append(("message type", nas[2]))
39 | if len(nas)>3:
40 | esm_list = nas_decode_esm(nas[2], nas[3:])
41 | nas_list += esm_list
42 | #esm#
43 |
44 | return nas_list
45 |
46 |
47 | #------------------------------------#
48 | # #
49 | # E M M - P r o c e d u r e s #
50 | # #
51 | #------------------------------------#
52 |
53 | #input: message_type and next bytes of nas with ies
54 | def nas_decode_emm(message_type, ies):
55 | ies_list = []
56 | if message_type == 66: # attach accept
57 | ies_list = nas_decode_emm_attach_accept(ies)
58 | elif message_type == 68: #attach reject
59 | ies_list = nas_decode_emm_attach_reject(ies)
60 | elif message_type == 69: #detach request
61 | ies_list = nas_decode_emm_detach_request(ies)
62 | elif message_type == 70: #detach accept
63 | ies_list = nas_decode_emm_detach_accept(ies)
64 | elif message_type == 73: #tracking area update accept
65 | ies_list = nas_decode_emm_tracking_area_update_accept(ies)
66 | elif message_type == 75: #tracking area update reject
67 | ies_list = nas_decode_emm_tracking_area_update_reject(ies)
68 | elif message_type == 78: #service reject
69 | ies_list = nas_decode_emm_service_reject(ies)
70 | elif message_type == 79: #service accept
71 | ies_list = nas_decode_emm_service_accept(ies)
72 | elif message_type == 80: #guti reallocation coomand
73 | ies_list = nas_decode_emm_guti_reallocation_command(ies)
74 | elif message_type == 82: #authentication request
75 | ies_list = nas_decode_emm_authentication_request(ies)
76 | elif message_type == 84: #authentication reject
77 | ies_list = nas_decode_emm_authentication_reject(ies)
78 | elif message_type == 85: #identity request
79 | ies_list = nas_decode_emm_identity_request(ies)
80 | elif message_type == 93: #security mode command
81 | ies_list = nas_decode_emm_security_mode_command(ies)
82 | elif message_type == 96: #emm status
83 | ies_list = nas_decode_emm_emm_status(ies)
84 | elif message_type == 97: #emm information
85 | ies_list = nas_decode_emm_emm_information(ies)
86 | elif message_type == 98: #downlink nas transport
87 | ies_list = nas_decode_emm_downlink_nas_transport(ies)
88 | elif message_type == 100: #cs service notification
89 | ies_list = nas_decode_emm_cs_service_notification(ies)
90 | elif message_type == 104: #downlink generic nas transport
91 | ies_list = nas_decode_emm_downlink_generic_nas_transport(ies)
92 | return ies_list
93 |
94 |
95 | def nas_decode_emm_attach_accept(ies):
96 | ies_list = []
97 | ies_list.append(("eps attach result", ies[0] % 16))
98 | ies_list.append(("t3412 value", ies[1]))
99 | tai_list_length = ies[2]
100 | ies_list.append(("tai list", ies[3:3+tai_list_length]))
101 | pointer = 3 + tai_list_length
102 | esm_message_container_length = ies[pointer]*256+ies[pointer+1]
103 | esm_message_container = ies[pointer+2:pointer+2+esm_message_container_length]
104 |
105 |
106 | ies_list.append(("esm message container",nas_decode(esm_message_container)))
107 | pointer = pointer+2+esm_message_container_length
108 |
109 | exit_while = False
110 |
111 | while len(ies)>pointer and exit_while == False:
112 | if ies[pointer] == 0x50: # guti
113 | guti_length = ies[pointer + 1]
114 | guti = ies[pointer+2:pointer+2+guti_length]
115 | ies_list.append(("guti", guti))
116 | pointer = pointer+2+guti_length
117 | elif ies[pointer] == 0x13: #location area identification
118 | ies_list.append(("location area identification", ies[pointer+1:pointer+6]))
119 | pointer = pointer+6
120 | elif ies[pointer] == 0x23: #ms identity
121 | ms_identity_length = ies[pointer + 1]
122 | ms_identity = ies[pointer+2:pointer+2+ms_identity_length]
123 | ies_list.append(("ms identity", ms_identity))
124 | pointer = pointer+2+ms_identity_length
125 |
126 | elif ies[pointer] == 0x53: #emm cause
127 | ies_list.append(("emm cause", ies[pointer+1:pointer+1]))
128 | pointer = pointer+2
129 | elif ies[pointer] == 0x17: #t3402 value
130 | ies_list.append(("t3402 value", ies[pointer+1:pointer+1]))
131 | pointer = pointer+2
132 | elif ies[pointer] == 0x59: #t3423 value
133 | ies_list.append(("t3423 value", ies[pointer+1:pointer+1]))
134 | pointer = pointer+2
135 |
136 | elif ies[pointer] == 0x4A: #equivalent plmns
137 | equivalent_plmns_length = ies[pointer + 1]
138 | equivalent_plmns = ies[pointer+2:pointer+2+equivalent_plmns_length]
139 | ies_list.append(("equivalent plmns", equivalent_plmns))
140 | pointer = pointer+2+equivalent_plmns_length
141 |
142 | elif ies[pointer] == 0x34: #emergency number list
143 | emergency_number_list_length = ies[pointer + 1]
144 | emergency_number_list = ies[pointer+2:pointer+2+emergency_number_list_length]
145 | ies_list.append(("emergency number list", emergency_number_list))
146 | pointer = pointer+2+emergency_number_list_length
147 |
148 | elif ies[pointer] == 0x64: #eps network feature support
149 | eps_network_feature_support_length = ies[pointer + 1]
150 | eps_network_feature_support = ies[pointer+2:pointer+2+eps_network_feature_support_length]
151 | ies_list.append(("eps network feature support", eps_network_feature_support))
152 | pointer = pointer+2+eps_network_feature_support_length
153 |
154 | elif ies[pointer] == 0x5E: #t3412 extended value
155 | t3412_extended_value_length = ies[pointer + 1]
156 | t3412_extended_value = ies[pointer+2:pointer+2+t3412_extended_value_length]
157 | ies_list.append(("t3412 extended value", t3412_extended_value))
158 | pointer = pointer+2+t3412_extended_value_length
159 |
160 | elif ies[pointer] // 16 == 0xF: # additional update result F-
161 | ies_list.append(("additional update result", ies[pointer]))
162 | pointer = pointer+1
163 |
164 | elif ies[pointer] == 0x6A: #t3324_value
165 | t3324_value_length = ies[pointer + 1]
166 | t3324_value = ies[pointer+2:pointer+2+t3324_value_length]
167 | ies_list.append(("t3324 value", t3324_value))
168 | pointer = pointer+2+t3324_value_length
169 |
170 | elif ies[pointer] == 0x6E: #extended_drx_parameters
171 | extended_drx_parameters_length = ies[pointer + 1]
172 | extended_drx_parameters = ies[pointer+2:pointer+2+extended_drx_parameters_length]
173 | ies_list.append(("extended drx parameters", extended_drx_parameters))
174 | pointer = pointer+2+extended_drx_parameters_length
175 |
176 | elif ies[pointer] == 0x65: #dcn_id
177 | dcn_id_length = ies[pointer + 1]
178 | dcn_id = ies[pointer+2:pointer+2+dcn_id_length]
179 | ies_list.append(("dcn-id", dcn_id))
180 | pointer = pointer+2+dcn_id_length
181 |
182 | elif ies[pointer] // 16 == 0xE: # sms_service_status
183 | ies_list.append(("sms service status", ies[pointer]))
184 | pointer = pointer+1
185 |
186 | elif ies[pointer] // 16 == 0xD: # non_3gpp_nw_provided_policies
187 | ies_list.append(("non 3gpp nw provided policies", ies[pointer]))
188 | pointer = pointer+1
189 |
190 | elif ies[pointer] == 0x6B: #t3448_value
191 | t3448_value_length = ies[pointer + 1]
192 | t3448_value = ies[pointer+2:pointer+2+t3448_value_length]
193 | ies_list.append(("t3448 value", t3448_value))
194 | pointer = pointer+2+t3448_value_length
195 |
196 | elif ies[pointer] // 16 == 0xC: # network policy
197 | ies_list.append(("network policy", ies[pointer]))
198 | pointer = pointer+1
199 |
200 |
201 | ######## LAST ONE TO EXIT WHILE LOOP ###
202 | else: # didn't find more IEs
203 | exit_while = True
204 |
205 | return ies_list
206 |
207 | def nas_decode_emm_attach_reject(ies):
208 | ies_list = []
209 | ies_list.append(("emm cause", ies[0]))
210 | pointer = 1
211 |
212 | exit_while = False
213 |
214 | while len(ies)>pointer and exit_while == False:
215 | if ies[pointer] == 0x78: # esm message container
216 | esm_message_container_length = ies[pointer+1]*256+ies[pointer+2]
217 | esm_message_container = ies[pointer+3:pointer+3+esm_message_container_length]
218 | ies_list.append(("esm message container",nas_decode(esm_message_container)))
219 | pointer = pointer+3+esm_message_container_length
220 |
221 | elif ies[pointer] == 0x5F: #t3346 value
222 | t3346_value_length = ies[pointer + 1]
223 | t3346_value = ies[pointer+2:pointer+2+t3346_value_length]
224 | ies_list.append(("t3346 value", t3346_value))
225 | pointer = pointer+2+t3346_value_length
226 |
227 | elif ies[pointer] == 0x16: #t3402 value
228 | t3402_value_length = ies[pointer + 1]
229 | t3402_value = ies[pointer+2:pointer+2+t3402_value_length]
230 | ies_list.append(("t3402 value", t3402_value))
231 | pointer = pointer+2+t3402_value_length
232 |
233 | elif ies[pointer] // 16 == 0xA: # extended emm cause
234 | ies_list.append(("extended emm cause", ies[pointer]))
235 | pointer = pointer+1
236 |
237 | ######## LAST ONE TO EXIT WHILE LOOP ###
238 | else: # didn't find more IEs
239 | exit_while = True
240 |
241 | return ies_list
242 |
243 | def nas_decode_emm_detach_request(ies):
244 | ies_list = []
245 | ies_list.append(("detach type", ies[0] % 16))
246 | pointer = 1
247 |
248 | exit_while = False
249 |
250 | while len(ies)>pointer and exit_while == False:
251 | if ies[pointer] == 0x53: #emm cause
252 | ies_list.append(("emm cause", ies[pointer+1:pointer+1]))
253 | pointer = pointer+2
254 |
255 | ######## LAST ONE TO EXIT WHILE LOOP ###
256 | else: # didn't find more IEs
257 | exit_while = True
258 |
259 | return ies_list
260 |
261 | def nas_decode_emm_detach_accept(ies):
262 | pass #done no IEI
263 |
264 |
265 | def nas_decode_emm_tracking_area_update_accept(ies):
266 | ies_list = []
267 | ies_list.append(("eps update result", ies[0] % 16))
268 |
269 | pointer = 1
270 |
271 | exit_while = False
272 |
273 | while len(ies)>pointer and exit_while == False:
274 | if ies[pointer] == 0x5a: # t3412_value
275 | ies_list.append(("t3412 value", ies[pointer+1]))
276 | pointer = pointer+2
277 | elif ies[pointer] == 0x50: # guti
278 | guti_length = ies[pointer + 1]
279 | guti = ies[pointer+2:pointer+2+guti_length]
280 | ies_list.append(("guti", guti))
281 | pointer = pointer+2+guti_length
282 | elif ies[pointer] == 0x54: #tai list
283 | tai_list_length = ies[pointer + 1]
284 | tai_list = ies[pointer+2:pointer+2+tai_list_length]
285 | ies_list.append(("tai list", tai_list))
286 | pointer = pointer+2+tai_list_length
287 | elif ies[pointer] == 0x57: #eps_bearer_context_status
288 | eps_bearer_context_status_length = ies[pointer + 1]
289 | eps_bearer_context_status = ies[pointer+2:pointer+2+eps_bearer_context_status_length]
290 | ies_list.append(("tai list", eps_bearer_context_status))
291 | pointer = pointer+2+eps_bearer_context_status_length
292 | elif ies[pointer] == 0x13: #location area identification
293 | ies_list.append(("location area identification", ies[pointer+1:pointer+6]))
294 | pointer = pointer+6
295 | elif ies[pointer] == 0x23: #ms identity
296 | ms_identity_length = ies[pointer + 1]
297 | ms_identity = ies[pointer+2:pointer+2+ms_identity_length]
298 | ies_list.append(("ms identity", ms_identity))
299 | pointer = pointer+2+ms_identity_length
300 |
301 | elif ies[pointer] == 0x53: #emm cause
302 | ies_list.append(("emm cause", ies[pointer+1:pointer+1]))
303 | pointer = pointer+2
304 | elif ies[pointer] == 0x17: #t3402 value
305 | ies_list.append(("t3402 value", ies[pointer+1:pointer+1]))
306 | pointer = pointer+2
307 | elif ies[pointer] == 0x59: #t3423 value
308 | ies_list.append(("t3423 value", ies[pointer+1:pointer+1]))
309 | pointer = pointer+2
310 |
311 | elif ies[pointer] == 0x4A: #equivalent plmns
312 | equivalent_plmns_length = ies[pointer + 1]
313 | equivalent_plmns = ies[pointer+2:pointer+2+equivalent_plmns_length]
314 | ies_list.append(("equivalent plmns", equivalent_plmns))
315 | pointer = pointer+2+equivalent_plmns_length
316 |
317 | elif ies[pointer] == 0x34: #emergency number list
318 | emergency_number_list_length = ies[pointer + 1]
319 | emergency_number_list = ies[pointer+2:pointer+2+emergency_number_list_length]
320 | ies_list.append(("emergency number list", emergency_number_list))
321 | pointer = pointer+2+emergency_number_list_length
322 |
323 | elif ies[pointer] == 0x64: #eps network feature support
324 | eps_network_feature_support_length = ies[pointer + 1]
325 | eps_network_feature_support = ies[pointer+2:pointer+2+eps_network_feature_support_length]
326 | ies_list.append(("eps network feature support", eps_network_feature_support))
327 | pointer = pointer+2+eps_network_feature_support_length
328 |
329 | elif ies[pointer] == 0x5E: #t3412 extended value
330 | t3412_extended_value_length = ies[pointer + 1]
331 | t3412_extended_value = ies[pointer+2:pointer+2+t3412_extended_value_length]
332 | ies_list.append(("t3412 extended value", t3412_extended_value))
333 | pointer = pointer+2+t3412_extended_value_length
334 |
335 | elif ies[pointer] // 16 == 0xF: # additional update result F-
336 | ies_list.append(("additional update result", ies[pointer]))
337 | pointer = pointer+1
338 |
339 | elif ies[pointer] == 0x6A: #t3324_value
340 | t3324_value_length = ies[pointer + 1]
341 | t3324_value = ies[pointer+2:pointer+2+t3324_value_length]
342 | ies_list.append(("t3324 value", t3324_value))
343 | pointer = pointer+2+t3324_value_length
344 |
345 | elif ies[pointer] == 0x6E: #extended_drx_parameters
346 | extended_drx_parameters_length = ies[pointer + 1]
347 | extended_drx_parameters = ies[pointer+2:pointer+2+extended_drx_parameters_length]
348 | ies_list.append(("extended drx parameters", extended_drx_parameters))
349 | pointer = pointer+2+extended_drx_parameters_length
350 |
351 | elif ies[pointer] == 0x65: #dcn_id
352 | dcn_id_length = ies[pointer + 1]
353 | dcn_id = ies[pointer+2:pointer+2+dcn_id_length]
354 | ies_list.append(("dcn-id", dcn_id))
355 | pointer = pointer+2+dcn_id_length
356 |
357 | elif ies[pointer] == 0x68: #header_compression_configuration_status
358 | header_compression_configuration_status_length = ies[pointer + 1]
359 | header_compression_configuration_status = ies[pointer+2:pointer+2+header_compression_configuration_status_length]
360 | ies_list.append(("header compression configuration status", header_compression_configuration_status))
361 | pointer = pointer+2+header_compression_configuration_status_length
362 |
363 | elif ies[pointer] // 16 == 0xE: # sms_service_status
364 | ies_list.append(("sms service status", ies[pointer]))
365 | pointer = pointer+1
366 |
367 | elif ies[pointer] // 16 == 0xD: # non_3gpp_nw_provided_policies
368 | ies_list.append(("non 3gpp nw provided policies", ies[pointer]))
369 | pointer = pointer+1
370 |
371 | elif ies[pointer] == 0x6B: #t3448_value
372 | t3448_value_length = ies[pointer + 1]
373 | t3448_value = ies[pointer+2:pointer+2+t3448_value_length]
374 | ies_list.append(("t3448 value", t3448_value))
375 | pointer = pointer+2+t3448_value_length
376 |
377 | elif ies[pointer] // 16 == 0xC: # network policy
378 | ies_list.append(("network policy", ies[pointer]))
379 | pointer = pointer+1
380 |
381 |
382 | ######## LAST ONE TO EXIT WHILE LOOP ###
383 | else: # didn't find more IEs
384 | exit_while = True
385 |
386 | return ies_list
387 |
388 | def nas_decode_emm_tracking_area_update_reject(ies):
389 | ies_list = []
390 | ies_list.append(("emm cause", ies[0]))
391 | pointer = 1
392 |
393 | exit_while = False
394 |
395 | while len(ies)>pointer and exit_while == False:
396 |
397 |
398 | if ies[pointer] == 0x5F: #t3346 value
399 | t3346_value_length = ies[pointer + 1]
400 | t3346_value = ies[pointer+2:pointer+2+t3346_value_length]
401 | ies_list.append(("t3346 value", t3346_value))
402 | pointer = pointer+2+t3346_value_length
403 |
404 | elif ies[pointer] // 16 == 0xA: # extended emm cause
405 | ies_list.append(("extended emm cause", ies[pointer]))
406 | pointer = pointer+1
407 |
408 | ######## LAST ONE TO EXIT WHILE LOOP ###
409 | else: # didn't find more IEs
410 | exit_while = True
411 |
412 | return ies_list
413 |
414 |
415 | def nas_decode_emm_service_reject(ies):
416 | ies_list = []
417 | ies_list.append(("emm cause", ies[0]))
418 | pointer = 1
419 |
420 | exit_while = False
421 |
422 | while len(ies)>pointer and exit_while == False:
423 | if ies[pointer] == 0x5B : # t3442
424 | ies_list.append(("t3442 value", ies[pointer+1:pointer+1]))
425 | pointer = pointer+2
426 |
427 | elif ies[pointer] == 0x5F: #t3346 value
428 | t3346_value_length = ies[pointer + 1]
429 | t3346_value = ies[pointer+2:pointer+2+t3346_value_length]
430 | ies_list.append(("t3346 value", t3346_value))
431 | pointer = pointer+2+t3346_value_length
432 |
433 | elif ies[pointer] == 0x6B: #t3448 value
434 | t3448_value_length = ies[pointer + 1]
435 | t3448_value = ies[pointer+2:pointer+2+t3448_value_length]
436 | ies_list.append(("t3448 value", t3448_value))
437 | pointer = pointer+2+t3448_value_length
438 |
439 | ######## LAST ONE TO EXIT WHILE LOOP ###
440 | else: # didn't find more IEs
441 | exit_while = True
442 |
443 | return ies_list
444 |
445 |
446 |
447 | def nas_decode_emm_service_accept(ies):
448 | ies_list = []
449 |
450 | pointer = 0
451 |
452 | exit_while = False
453 |
454 | while len(ies)>pointer and exit_while == False:
455 | if ies[pointer] == 0x5F: #t3346 value
456 | eps_bearer_context_status_length = ies[pointer + 1]
457 | eps_bearer_context_status = ies[pointer+2:pointer+2+eps_bearer_context_status_length]
458 | ies_list.append(("eps bearer context status", eps_bearer_context_status))
459 | pointer = pointer+2+eps_bearer_context_status_length
460 |
461 | elif ies[pointer] == 0x6B: #t3448 value
462 | t3448_value_length = ies[pointer + 1]
463 | t3448_value = ies[pointer+2:pointer+2+t3448_value_length]
464 | ies_list.append(("t3448 value", t3448_value))
465 | pointer = pointer+2+t3448_value_length
466 |
467 | ######## LAST ONE TO EXIT WHILE LOOP ###
468 | else: # didn't find more IEs
469 | exit_while = True
470 |
471 | return ies_list
472 |
473 | def nas_decode_emm_guti_reallocation_command(ies):
474 | ies_list = []
475 | ies_list.append(("guti", ies[0:0+12]))
476 | pointer = 1+12
477 | exit_while = False
478 |
479 | while len(ies)>pointer and exit_while == False:
480 | if ies[pointer] == 0x54: #tai list
481 | tai_list_length = ies[pointer + 1]
482 | tai_list = ies[pointer+2:pointer+2+tai_list_length]
483 | ies_list.append(("tai list", tai_list))
484 | pointer = pointer+2+tai_list_length
485 |
486 | elif ies[pointer] == 0x65: #dcn_id
487 | dcn_id_length = ies[pointer + 1]
488 | dcn_id = ies[pointer+2:pointer+2+dcn_id_length]
489 | ies_list.append(("dcn-id", dcn_id))
490 | pointer = pointer+2+dcn_id_length
491 |
492 |
493 | ######## LAST ONE TO EXIT WHILE LOOP ###
494 | else: # didn't find more IEs
495 | exit_while = True
496 |
497 | return ies_list
498 |
499 | def nas_decode_emm_authentication_request(ies):
500 | ies_list = []
501 | ies_list.append(("nas key set identifier", ies[0] % 16))
502 | ies_list.append(("rand", ies[1:1+16]))
503 | pointer = 1+16
504 | autn_length = ies[pointer]
505 | ies_list.append(("autn", ies[pointer+1:pointer+1+autn_length]))
506 |
507 | return ies_list
508 |
509 | def nas_decode_emm_authentication_reject(ies):
510 | pass #done no IEI
511 |
512 | def nas_decode_emm_identity_request(ies):
513 | ies_list = []
514 | ies_list.append(("identity type", ies[0] % 16))
515 |
516 | return ies_list
517 |
518 | def nas_decode_emm_security_mode_command(ies):
519 | ies_list = []
520 | ies_list.append(("selected nas security algorithms", ies[0]))
521 | ies_list.append(("nas key set identifier", ies[1] % 16 ))
522 | pointer = 2
523 | replayed_ue_security_capabilities_length = ies[pointer]
524 | ies_list.append(("replayed ue security capabilities", ies[pointer+1:pointer+1+replayed_ue_security_capabilities_length]))
525 | pointer = pointer+1+replayed_ue_security_capabilities_length
526 |
527 | exit_while = False
528 |
529 | while len(ies)>pointer and exit_while == False:
530 | if ies[pointer] == 0x55: #replayed nonce ue
531 | ies_list.append(("replayed nonce ue", ies[pointer+1:pointer+5]))
532 | pointer = pointer+5
533 | elif ies[pointer] == 0x56: # nonce mme
534 | ies_list.append(("nonce mme", ies[pointer+1:pointer+5]))
535 | pointer = pointer+5
536 | elif ies[pointer] // 16 == 0xc: # imeisv request C-
537 | ies_list.append(("imeisv request", ies[pointer]))
538 | pointer = pointer+1
539 |
540 | elif ies[pointer] == 0x4f: # hash_mme
541 | hash_mme_length = ies[pointer + 1]
542 | hash_mme = ies[pointer+2:pointer+2+hash_mme_length]
543 | ies_list.append(("hash mme", hash_mme))
544 | pointer = pointer+2+hash_mme_length
545 |
546 | elif ies[pointer] == 0x6f: # replayed_ue_additional_security_capability
547 | replayed_ue_additional_security_capability_length = ies[pointer + 1]
548 | replayed_ue_additional_security_capability = ies[pointer+2:pointer+2+replayed_ue_additional_security_capability_length]
549 | ies_list.append(("replayed ue additional security capability", replayed_ue_additional_security_capability))
550 | pointer = pointer+2+replayed_ue_additional_security_capability_length
551 |
552 | ######## LAST ONE TO EXIT WHILE LOOP ###
553 | else: # didn't find more IEs
554 | exit_while = True
555 |
556 | return ies_list
557 |
558 | def nas_decode_emm_emm_status(ies):
559 | ies_list = []
560 | ies_list.append(("emm cause", ies[0]))
561 |
562 | return ies_list
563 |
564 | def nas_decode_emm_emm_information(ies):
565 | ies_list = []
566 |
567 | pointer = 0
568 |
569 | exit_while = False
570 |
571 | while len(ies)>pointer and exit_while == False:
572 | if ies[pointer] == 0x43: # full name for network
573 | full_name_for_network_length = ies[pointer + 1]
574 | full_name_for_network = ies[pointer+2:pointer+2+full_name_for_network_length]
575 | ies_list.append(("full name for network", full_name_for_network))
576 | pointer = pointer+2+full_name_for_network_length
577 | elif ies[pointer] == 0x45: # short name for network
578 | short_name_for_network_length = ies[pointer + 1]
579 | short_name_for_network = ies[pointer+2:pointer+2+short_name_for_network_length]
580 | ies_list.append(("short name for network", short_name_for_network))
581 | pointer = pointer+2+short_name_for_network_length
582 | elif ies[pointer] == 0x49: # network daylight saving time
583 | network_daylight_saving_time_length = ies[pointer + 1]
584 | network_daylight_saving_time = ies[pointer+2:pointer+2+network_daylight_saving_time_length]
585 | ies_list.append(("network daylight saving time", network_daylight_saving_time))
586 | pointer = pointer+2+network_daylight_saving_time_length
587 |
588 | elif ies[pointer] == 0x46: # local time zone
589 | ies_list.append(("local time zone", ies[pointer+1:pointer+1]))
590 | pointer = pointer+2
591 | elif ies[pointer] == 0x47: # universal time and local time zone
592 | ies_list.append(("universal time and local time zone", ies[pointer+1:pointer+8]))
593 | pointer = pointer+8
594 |
595 | ######## LAST ONE TO EXIT WHILE LOOP ###
596 | else: # didn't find more IEs
597 | exit_while = True
598 |
599 | return ies_list
600 |
601 | def nas_decode_emm_downlink_nas_transport(ies):
602 | ies_list = []
603 |
604 | pointer = 0
605 | nas_message_container_length = ies[pointer]
606 | nas_message_container = ies[pointer+1:pointer+1+nas_message_container_length]
607 |
608 | ies_list.append(("nas message container",nas_message_container))
609 |
610 | return ies_list
611 |
612 |
613 | def nas_decode_emm_downlink_generic_nas_transport(ies):
614 | ies_list = []
615 | ies_list.append(("generic message container type", ies[0]))
616 |
617 | pointer = 1
618 | generic_message_container_length = ies[pointer]*256+ies[pointer+1]
619 | generic_message_container = ies[pointer+2:pointer+2+generic_message_container_length]
620 |
621 | ies_list.append(("generic message container",generic_message_container))
622 | pointer = pointer+2+esm_message_container_length
623 |
624 |
625 | exit_while = False
626 |
627 | while len(ies)>pointer and exit_while == False:
628 | if ies[pointer] == 0x65: # additional information
629 | additional_information_length = ies[pointer + 1]
630 | additional_information = ies[pointer+2:pointer+2+additional_information_length]
631 | ies_list.append(("additional information", additional_information))
632 | pointer = pointer+2+additional_information_length
633 |
634 | ######## LAST ONE TO EXIT WHILE LOOP ###
635 | else: # didn't find more IEs
636 | exit_while = True
637 |
638 | return ies_list
639 |
640 |
641 | def nas_decode_emm_cs_service_notification(ies):
642 | ies_list = []
643 | ies_list.append(("paging identity", ies[0]))
644 |
645 | pointer = 1
646 |
647 | exit_while = False
648 |
649 | while len(ies)>pointer and exit_while == False:
650 |
651 | if ies[pointer] == 0x60: # CLI
652 | cli_length = ies[pointer + 1]
653 | cli = ies[pointer+2:pointer+2+cli_length]
654 | ies_list.append(("cli", cli))
655 | pointer = pointer+2+cli_length
656 | elif ies[pointer] == 0x61: #ss code
657 | ies_list.append(("ss code", ies[pointer+1:pointer+1]))
658 | pointer = pointer+2
659 | elif ies[pointer] == 0x62: # lcs indicator
660 | ies_list.append(("lcs indicator", ies[pointer+1:pointer+1]))
661 | pointer = pointer+2
662 | elif ies[pointer] == 0x63: # lcs client identity
663 | lcs_client_identity_length = ies[pointer + 1]
664 | lcs_client_identity = ies[pointer+2:pointer+2+lcs_client_identity_length]
665 | ies_list.append(("lcs client identity", lcs_client_identity))
666 | pointer = pointer+2+lcs_client_identity_length
667 |
668 | ######## LAST ONE TO EXIT WHILE LOOP ###
669 | else: # didn't find more IEs
670 | exit_while = True
671 |
672 | return ies_list
673 |
674 |
675 |
676 | #------------------------------------#
677 | # #
678 | # E S M - P r o c e d u r e s #
679 | # #
680 | #------------------------------------#
681 |
682 | #inputs: message_type and next bytes of nas with ies
683 | def nas_decode_esm(message_type, ies):
684 | ies_list = []
685 | if message_type == 193: # activate default eps bearer context request
686 | ies_list = nas_decode_esm_activate_default_eps_bearer_context_request(ies)
687 | elif message_type == 197: # Activate dedicated EPS bearer context request
688 | ies_list = nas_decoded_esm_activate_dedicated_eps_bearer_context_request(ies)
689 | elif message_type == 201: # Modify EPS bearer context request
690 | ies_list = nas_decode_esm_modify_eps_bearer_context_request(ies)
691 | elif message_type == 205: # deactivate eps bearer context request
692 | ies_list = nas_decode_esm_deactivate_eps_bearer_context_request(ies)
693 | elif message_type == 209: # pdn connectivity reject
694 | ies_list = nas_decode_esm_pdn_connectivity_reject(ies)
695 | elif message_type == 211: # pdn disconnect reject
696 | ies_list = nas_decode_esm_pdn_disconnect_reject(ies)
697 | elif message_type == 217: # esm information request
698 | ies_list = nas_decode_esm_esm_information_request(ies)
699 | elif message_type == 235: # esm data transport
700 | ies_list = nas_decode_esm_esm_data_transport(ies)
701 | return ies_list
702 |
703 |
704 | def nas_decode_esm_activate_default_eps_bearer_context_request(ies):
705 | ies_list = []
706 | eps_qos_length = ies[0]
707 | ies_list.append(("eps qos", ies[1:1+eps_qos_length]))
708 | pointer = 1 + eps_qos_length
709 | access_point_name_length = ies[pointer]
710 | ies_list.append(("access point name", ies[pointer+1:pointer+1+access_point_name_length]))
711 | pointer += 1 + access_point_name_length
712 | pdn_address_length = ies[pointer]
713 | ies_list.append(("pdn address", ies[pointer+1:pointer+1+pdn_address_length]))
714 | pointer += 1 + pdn_address_length
715 |
716 | exit_while = False
717 |
718 | while len(ies)>pointer and exit_while == False:
719 | if ies[pointer] == 0x5D: #transaction identifier
720 | transaction_identifier_length = ies[pointer + 1]
721 | transaction_identifier = ies[pointer+2:pointer+2+transaction_identifier_length]
722 | ies_list.append(("transaction identifier", transaction_identifier))
723 | pointer = pointer+2+transaction_identifier_length
724 | elif ies[pointer] == 0x30: #negotiated qos
725 | negotiated_qos_length = ies[pointer + 1]
726 | negotiated_qos = ies[pointer+2:pointer+2+negotiated_qos_length]
727 | ies_list.append(("negotiated qos", negotiated_qos))
728 | pointer = pointer+2+negotiated_qos_length
729 | elif ies[pointer] == 0x34: #packet flow identifier
730 | packet_flow_identifier_length = ies[pointer + 1]
731 | packet_flow_identifier = ies[pointer+2:pointer+2+packet_flow_identifier_length]
732 | ies_list.append(("packet flow identifier", packet_flow_identifier))
733 | pointer = pointer+2+packet_flow_identifier_length
734 | elif ies[pointer] == 0x5E: #apn-ambr
735 | apn_ambr_length = ies[pointer + 1]
736 | apn_ambr = ies[pointer+2:pointer+2+apn_ambr_length]
737 | ies_list.append(("apn-ambr", apn_ambr))
738 | pointer = pointer+2+apn_ambr_length
739 | elif ies[pointer] == 0x27: #protocol configuration options
740 | protocol_configuration_options_length = ies[pointer + 1]
741 | protocol_configuration_options = ies[pointer+2:pointer+2+protocol_configuration_options_length]
742 | ies_list.append(("protocol configuration options", protocol_configuration_options))
743 | pointer = pointer+2+protocol_configuration_options_length
744 | elif ies[pointer] == 0x32: #negotiated llc sapi
745 | ies_list.append(("negotiated llc sapi", ies[pointer+1:pointer+1]))
746 | pointer = pointer+2
747 | elif ies[pointer] == 0x58: #esm cause
748 | ies_list.append(("esm cause", ies[pointer+1:pointer+1]))
749 | pointer = pointer+2
750 | elif ies[pointer] // 16 == 0x8: # radio priority 8-
751 | ies_list.append(("radio priority", ies[pointer]))
752 | pointer = pointer+1
753 | elif ies[pointer] // 16 == 0xB: # connectivity type B-
754 | ies_list.append(("connectivity type", ies[pointer]))
755 | pointer = pointer+1
756 | elif ies[pointer] // 16 == 0xC: # wlan offload indication C-
757 | ies_list.append(("wlan offload indication", ies[pointer]))
758 | pointer = pointer+1
759 | elif ies[pointer] // 16 == 0x9: # control plane only indication 9-
760 | ies_list.append(("control plane only indication", ies[pointer]))
761 | pointer = pointer+1
762 |
763 | elif ies[pointer] == 0x7B: # extended_protocol_configuration_options
764 | extended_protocol_configuration_options_length = ies[pointer+1]*256+ies[pointer+2]
765 | extended_protocol_configuration_options = ies[pointer+3:pointer+3+extended_protocol_configuration_options_length]
766 | ies_list.append(("extended protocol configuration options",nas_decode(extended_protocol_configuration_options)))
767 | pointer = pointer+3+extended_protocol_configuration_options_length
768 | elif ies[pointer] == 0x6E: #serving_plmn_rate_control
769 | serving_plmn_rate_control_length = ies[pointer + 1]
770 | serving_plmn_rate_control = ies[pointer+2:pointer+2+serving_plmn_rate_control_length]
771 | ies_list.append(("serving plmn rate control", serving_plmn_rate_control))
772 | pointer = pointer+2+serving_plmn_rate_control_length
773 |
774 | elif ies[pointer] == 0x5F: #extended apn-ambr
775 | extended_apn_ambr_length = ies[pointer + 1]
776 | extended_apn_ambr = ies[pointer+2:pointer+2+extended_apn_ambr_length]
777 | ies_list.append(("extended apn-ambr", extended_apn_ambr))
778 | pointer = pointer+2+extended_apn_ambr_length
779 |
780 | elif ies[pointer] == 0x5C: #extended_eps_qos
781 | extended_eps_qos_length = ies[pointer + 1]
782 | extended_eps_qos = ies[pointer+2:pointer+2+extended_eps_qos_length]
783 | ies_list.append(("extended eps qos", extended_eps_qos))
784 | pointer = pointer+2+extended_eps_qos_length
785 |
786 |
787 | ######## LAST ONE TO EXIT WHILE LOOP ###
788 | else: # didn't find more IEs
789 | exit_while = True
790 |
791 | return ies_list
792 |
793 |
794 |
795 |
796 | def nas_decode_esm_modify_eps_bearer_context_request(ies):
797 | ies_list = []
798 | pointer = 0
799 |
800 | exit_while = False
801 |
802 | while len(ies)>pointer and exit_while == False:
803 | if ies[pointer] == 0x5B: #new eps qos
804 | new_eps_qos_length = ies[pointer + 1]
805 | new_eps_qos = ies[pointer+2:pointer+2+new_eps_qos_length]
806 | ies_list.append(("new eps qos", new_eps_qos))
807 | pointer = pointer+2+new_eps_qos_length
808 | elif ies[pointer] == 0x36: #tft
809 | tft_length = ies[pointer + 1]
810 | tft = ies[pointer+2:pointer+2+tft_length]
811 | ies_list.append(("tft", tft))
812 | pointer = pointer+2+tft_length
813 | elif ies[pointer] == 0x30: #new qos
814 | new_qos_length = ies[pointer + 1]
815 | new_qos = ies[pointer+2:pointer+2+new_qos_length]
816 | ies_list.append(("new qos", new_qos))
817 | pointer = pointer+2+new_qos_length
818 | elif ies[pointer] == 0x32: #negotiated llc sapi
819 | ies_list.append(("negotiated llc sapi", ies[pointer+1:pointer+1]))
820 | pointer = pointer+2
821 | elif ies[pointer] // 16 == 0x8: # radio priority 8-
822 | ies_list.append(("radio priority", ies[pointer]))
823 | pointer = pointer+1
824 | elif ies[pointer] == 0x34: #packet flow identifier
825 | packet_flow_identifier_length = ies[pointer + 1]
826 | packet_flow_identifier = ies[pointer+2:pointer+2+packet_flow_identifier_length]
827 | ies_list.append(("packet flow identifier", packet_flow_identifier))
828 | pointer = pointer+2+packet_flow_identifier_length
829 | elif ies[pointer] == 0x5E: #apn-ambr
830 | apn_ambr_length = ies[pointer + 1]
831 | apn_ambr = ies[pointer+2:pointer+2+apn_ambr_length]
832 | ies_list.append(("apn-ambr", apn_ambr))
833 | pointer = pointer+2+apn_ambr_length
834 | elif ies[pointer] == 0x27: #protocol configuration options
835 | protocol_configuration_options_length = ies[pointer + 1]
836 | protocol_configuration_options = ies[pointer+2:pointer+2+protocol_configuration_options_length]
837 | ies_list.append(("protocol configuration options", protocol_configuration_options))
838 | pointer = pointer+2+protocol_configuration_options_length
839 | elif ies[pointer] // 16 == 0xC: # wlan offload indication C-
840 | ies_list.append(("wlan offload indication", ies[pointer]))
841 | pointer = pointer+1
842 | elif ies[pointer] == 0x33: #nbifom container
843 | nbifom_container_length = ies[pointer + 1]
844 | nbifom_container = ies[pointer+2:pointer+2+nbifom_container_length]
845 | ies_list.append(("nbifom container", nbifom_container))
846 | pointer = pointer+2+nbifom_container_length
847 | elif ies[pointer] == 0x66: #header compression configuration
848 | header_compression_configuration_length = ies[pointer + 1]
849 | header_compression_configuration = ies[pointer+2:pointer+2+header_compression_configuration_length]
850 | ies_list.append(("header compression configuration", header_compression_configuration))
851 | pointer = pointer+2+header_compression_configuration_length
852 | elif ies[pointer] == 0x7B: # extended_protocol_configuration_options
853 | extended_protocol_configuration_options_length = ies[pointer+1]*256+ies[pointer+2]
854 | extended_protocol_configuration_options = ies[pointer+3:pointer+3+extended_protocol_configuration_options_length]
855 | ies_list.append(("extended protocol configuration options",nas_decode(extended_protocol_configuration_options)))
856 | pointer = pointer+3+extended_protocol_configuration_options_length
857 | elif ies[pointer] == 0x5F: #extended apn-ambr
858 | extended_apn_ambr_length = ies[pointer + 1]
859 | extended_apn_ambr = ies[pointer+2:pointer+2+extended_apn_ambr_length]
860 | ies_list.append(("extended apn-ambr", extended_apn_ambr))
861 | pointer = pointer+2+extended_apn_ambr_length
862 | elif ies[pointer] == 0x5C: #extended_eps_qos
863 | extended_eps_qos_length = ies[pointer + 1]
864 | extended_eps_qos = ies[pointer+2:pointer+2+extended_eps_qos_length]
865 | ies_list.append(("extended eps qos", extended_eps_qos))
866 | pointer = pointer+2+extended_eps_qos_length
867 |
868 |
869 | ######## LAST ONE TO EXIT WHILE LOOP ###
870 | else: # didn't find more IEs
871 | exit_while = True
872 |
873 | return ies_list
874 |
875 |
876 |
877 | def nas_decoded_esm_activate_dedicated_eps_bearer_context_request(ies):
878 |
879 | ies_list = []
880 | ies_list.append(("linked eps bearer identity", ies[0] % 16))
881 |
882 | eps_qos_length = ies[1]
883 | ies_list.append(("eps qos", ies[2:2+eps_qos_length]))
884 | pointer = 2 + eps_qos_length
885 |
886 | tft_length = ies[pointer]
887 | ies_list.append(("tft", ies[pointer+1:pointer+1+tft_length]))
888 | pointer += 1 + tft_length
889 |
890 |
891 | exit_while = False
892 |
893 | while len(ies)>pointer and exit_while == False:
894 | if ies[pointer] == 0x5D: #transaction identifier
895 | transaction_identifier_length = ies[pointer + 1]
896 | transaction_identifier = ies[pointer+2:pointer+2+transaction_identifier_length]
897 | ies_list.append(("transaction identifier", transaction_identifier))
898 | pointer = pointer+2+transaction_identifier_length
899 | elif ies[pointer] == 0x30: #negotiated qos
900 | negotiated_qos_length = ies[pointer + 1]
901 | negotiated_qos = ies[pointer+2:pointer+2+negotiated_qos_length]
902 | ies_list.append(("negotiated qos", negotiated_qos))
903 | pointer = pointer+2+negotiated_qos_length
904 | elif ies[pointer] == 0x34: #packet flow identifier
905 | packet_flow_identifier_length = ies[pointer + 1]
906 | packet_flow_identifier = ies[pointer+2:pointer+2+packet_flow_identifier_length]
907 | ies_list.append(("packet flow identifier", packet_flow_identifier))
908 | pointer = pointer+2+packet_flow_identifier_length
909 | elif ies[pointer] == 0x33: #nbifom container
910 | nbifom_container_length = ies[pointer + 1]
911 | nbifom_container = ies[pointer+2:pointer+2+nbifom_container_length]
912 | ies_list.append(("nbifom container", nbifom_container))
913 | pointer = pointer+2+nbifom_container_length
914 | elif ies[pointer] == 0x27: #protocol configuration options
915 | protocol_configuration_options_length = ies[pointer + 1]
916 | protocol_configuration_options = ies[pointer+2:pointer+2+protocol_configuration_options_length]
917 | ies_list.append(("protocol configuration options", protocol_configuration_options))
918 | pointer = pointer+2+protocol_configuration_options_length
919 | elif ies[pointer] == 0x32: #negotiated llc sapi
920 | ies_list.append(("negotiated llc sapi", ies[pointer+1:pointer+1]))
921 | pointer = pointer+2
922 | elif ies[pointer] == 0x58: #esm cause
923 | ies_list.append(("esm cause", ies[pointer+1:pointer+1]))
924 | pointer = pointer+2
925 | elif ies[pointer] // 16 == 0x8: # radio priority 8-
926 | ies_list.append(("radio priority", ies[pointer]))
927 | pointer = pointer+1
928 | elif ies[pointer] // 16 == 0xC: # wlan offload indication C-
929 | ies_list.append(("wlan offload indication", ies[pointer]))
930 | pointer = pointer+1
931 |
932 |
933 | elif ies[pointer] == 0x7B: # extended_protocol_configuration_options
934 | extended_protocol_configuration_options_length = ies[pointer+1]*256+ies[pointer+2]
935 | extended_protocol_configuration_options = ies[pointer+3:pointer+3+extended_protocol_configuration_options_length]
936 | ies_list.append(("extended protocol configuration options",nas_decode(extended_protocol_configuration_options)))
937 | pointer = pointer+3+extended_protocol_configuration_options_length
938 |
939 |
940 | elif ies[pointer] == 0x5C: #extended_eps_qos
941 | extended_eps_qos_length = ies[pointer + 1]
942 | extended_eps_qos = ies[pointer+2:pointer+2+extended_eps_qos_length]
943 | ies_list.append(("extended eps qos", extended_eps_qos))
944 | pointer = pointer+2+extended_eps_qos_length
945 |
946 |
947 | ######## LAST ONE TO EXIT WHILE LOOP ###
948 | else: # didn't find more IEs
949 | exit_while = True
950 |
951 | return ies_list
952 | def nas_decode_esm_deactivate_eps_bearer_context_request(ies):
953 | ies_list = []
954 | ies_list.append(("esm cause", ies[0]))
955 | pointer = 1
956 | exit_while = False
957 |
958 | while len(ies)>pointer and exit_while == False:
959 | if ies[pointer] == 0x27: #protocol configuration options
960 | protocol_configuration_options_length = ies[pointer + 1]
961 | protocol_configuration_options = ies[pointer+2:pointer+2+protocol_configuration_options_length]
962 | ies_list.append(("protocol configuration options", protocol_configuration_options))
963 | pointer = pointer+2+protocol_configuration_options_length
964 |
965 |
966 | ######## LAST ONE TO EXIT WHILE LOOP ###
967 | else: # didn't find more IEs
968 | exit_while = True
969 |
970 | return ies_list
971 |
972 | def nas_decode_esm_pdn_connectivity_reject(ies):
973 | ies_list = []
974 | ies_list.append(("esm cause", ies[0]))
975 | pointer = 1
976 | exit_while = False
977 |
978 | while len(ies)>pointer and exit_while == False:
979 | if ies[pointer] == 0x27: #protocol configuration options
980 | protocol_configuration_options_length = ies[pointer + 1]
981 | protocol_configuration_options = ies[pointer+2:pointer+2+protocol_configuration_options_length]
982 | ies_list.append(("protocol configuration options", protocol_configuration_options))
983 | pointer = pointer+2+protocol_configuration_options_length
984 |
985 | elif ies[pointer] == 0x37: #t3396 value
986 | t3396_value_length = ies[pointer + 1]
987 | t3396_value = ies[pointer+2:pointer+2+t3396_value_length]
988 | ies_list.append(("t3396 value", t3396_value))
989 | pointer = pointer+2+t3396_value_length
990 |
991 |
992 | ######## LAST ONE TO EXIT WHILE LOOP ###
993 | else: # didn't find more IEs
994 | exit_while = True
995 |
996 | return ies_list
997 |
998 | def nas_decode_esm_pdn_disconnect_reject(ies):
999 | ies_list = []
1000 | ies_list.append(("esm cause", ies[0]))
1001 | pointer = 1
1002 | exit_while = False
1003 |
1004 | while len(ies)>pointer and exit_while == False:
1005 | if ies[pointer] == 0x27: #protocol configuration options
1006 | protocol_configuration_options_length = ies[pointer + 1]
1007 | protocol_configuration_options = ies[pointer+2:pointer+2+protocol_configuration_options_length]
1008 | ies_list.append(("protocol configuration options", protocol_configuration_options))
1009 | pointer = pointer+2+protocol_configuration_options_length
1010 |
1011 |
1012 | ######## LAST ONE TO EXIT WHILE LOOP ###
1013 | else: # didn't find more IEs
1014 | exit_while = True
1015 |
1016 | return ies_list
1017 | def nas_decode_esm_esm_information_request(ies):
1018 | pass #done no IEI
1019 |
1020 |
1021 | def nas_decode_esm_esm_data_transport(ies):
1022 | ies_list = []
1023 | pointer = 0
1024 | user_data_container_length = ies[pointer]*256+ies[pointer+1]
1025 | user_data_container = ies[pointer+2:pointer+2+user_data_container_length]
1026 | ies_list.append(("user data container",user_data_container))
1027 | pointer = pointer+2+user_data_container_length
1028 |
1029 | exit_while = False
1030 |
1031 | while len(ies)>pointer and exit_while == False:
1032 | if ies[pointer] // 16 == 0xF: # release assistance indication F-
1033 | ies_list.append(("release assistance indication", ies[pointer]))
1034 | pointer = pointer+1
1035 |
1036 | ######## LAST ONE TO EXIT WHILE LOOP ###
1037 | else: # didn't find more IEs
1038 | exit_while = True
1039 |
1040 | return ies_list
1041 |
1042 | ######################################################################################################################
1043 | ######################################################################################################################
1044 | ######################################################################################################################
1045 |
1046 | #[(protocol_discriminator, security_header), (iei1, format, value), (iei2, format, value), etc...]
1047 | # iei = 0 if mandatory. i[2] in bytes format
1048 | # other values as 0x19. i[2] in bytes format
1049 | # if half byte it should be like 0xF. the other part i[2] is in decimal
1050 | #
1051 | #input nas_list with sequencial
1052 | def nas_encode(nas_list):
1053 | nas = b''
1054 | protocol_discriminator = nas_list[0][0]
1055 | security_header = nas_list[0][1]
1056 | nas += bytes([(security_header<<4)+protocol_discriminator])
1057 | for i in range(1,len(nas_list)):
1058 | if nas_list[i][0] == 0:
1059 | if nas_list[i][1] == 'V':
1060 | nas += nas_list[i][2]
1061 | elif nas_list[i][1] == 'LV':
1062 | nas += bytes([len(nas_list[i][2])]) + nas_list[i][2]
1063 | elif nas_list[i][1] == 'LV-E':
1064 | nas += bytes([len(nas_list[i][2])//256]) + bytes([len(nas_list[i][2])%256]) + nas_list[i][2]
1065 | else:
1066 | if nas_list[i][1] == "TV":
1067 | if nas_list[i][0] < 16: #one hex symbol is just one byte len. always TV
1068 | nas += bytes([(nas_list[i][0]<<4) + nas_list[i][2]])
1069 | else:
1070 | nas += bytes([nas_list[i][0]]) + nas_list[i][2]
1071 | if nas_list[i][1] == "TLV":
1072 | nas += bytes([nas_list[i][0]]) + bytes([len(nas_list[i][2])]) + nas_list[i][2]
1073 | if nas_list[i][1] == "TLV-E":
1074 | nas += bytes([nas_list[i][0]]) + bytes([len(nas_list[i][2])//256]) + bytes([len(nas_list[i][2])%256]) + nas_list[i][2]
1075 |
1076 |
1077 | return nas
1078 |
1079 |
1080 |
1081 |
1082 |
1083 | ######################################################################################################################
1084 | ######################################################################################################################
1085 | ######################################################################################################################
1086 | #
1087 | # specific Fucntions to decode/encode some NAS IEI
1088 | #
1089 | #
1090 |
1091 |
1092 | def decode_eps_mobile_identity(iei):
1093 | iei_list = []
1094 | type_of_identity = iei[0] % 8
1095 | iei_list.append(('type of identity', type_of_identity))
1096 | if type_of_identity == 1 or type_of_identity == 3: #imsi or imei
1097 | odd_even_indicator = (iei[0]%16)>>3
1098 | digits = str(iei[0]//16)
1099 | for i in range(1,len(iei)):
1100 | digits += str(iei[i]%16) + str(iei[i]//16)
1101 | if odd_even_indicator == 0:
1102 | digits = digits[:-1]
1103 | digits = int(digits)
1104 | iei_list.append(('digits', digits))
1105 | elif type_of_identity == 6:
1106 | iei_list.append(('mcc',int(str(iei[1]%16) + str(iei[1]//16) + str(iei[2]%16))))
1107 | if iei[2] // 16 == 15: #1111
1108 | iei_list.append(('mnc',int(str(iei[3]%16) + str(iei[3]//16))))
1109 | else:
1110 | iei_list.append(('mnc',int(str(iei[3]%16) + str(iei[3]//16) + str(iei[2]//16))))
1111 | iei_list.append(('mme group id', 256*iei[4] + iei[5]))
1112 | iei_list.append(('mme code', iei[6]))
1113 | iei_list.append(('m-tmsi', struct.unpack("!I", iei[7:11])[0]))
1114 | iei_list.append(('s-tmsi', iei[6:11]))
1115 | return iei_list
1116 |
1117 |
1118 | def decode_pdn_address(iei):
1119 | iei_list = []
1120 | pdn_type_value = iei[0] % 8
1121 | iei_list.append(('pdn type value', pdn_type_value))
1122 | if pdn_type_value == 1: # ipv4
1123 | iei_list.append(('ipv4',socket.inet_ntop(socket.AF_INET, iei[1:1+4])))
1124 | elif pdn_type_value == 2: # ipv6
1125 | iei_list.append(('ipv6', socket.inet_ntop(socket.AF_INET6, iei[1:1+8] + 8*b'\x00')))
1126 | elif pdn_type_value == 3: # ipv4v6
1127 | iei_list.append(('ipv6', socket.inet_ntop(socket.AF_INET6, iei[1:1+8] + 8*b'\x00')))
1128 | iei_list.append(('ipv4',socket.inet_ntop(socket.AF_INET, iei[9:9+4])))
1129 | return iei_list
1130 |
1131 | def decode_apn(byteArray):
1132 | a = []
1133 | pos = 0
1134 | while pos < len(byteArray):
1135 | i = int(byteArray[pos])
1136 | for x in range(pos+1, pos+1+i):
1137 | a.append(chr(byteArray[x]))
1138 |
1139 | a.append(".")
1140 | pos = pos+1+i
1141 |
1142 | return [('apn', ''.join(a)[:-1])]
1143 |
1144 | def encode_apn(apn):
1145 | apn_bytes = bytes()
1146 | apn_l = apn.split(".")
1147 | for word in apn_l:
1148 | apn_bytes += struct.pack("!B", len(word)) + word.encode()
1149 | return apn_bytes
1150 |
1151 | def encode_guti(mcc_mnc, mme_group_id, mme_code, m_tmsi):
1152 | guti = b'\xf6'
1153 | mcc_mnc = str(mcc_mnc)
1154 |
1155 | if len(mcc_mnc) == 5: mcc_mnc += 'f'
1156 | guti += unhexlify(mcc_mnc[1] + mcc_mnc[0] + mcc_mnc[5] +mcc_mnc[2]+ mcc_mnc[4]+ mcc_mnc[3])
1157 | guti += struct.pack("!H", mme_group_id)
1158 | guti += struct.pack("!B", mme_code)
1159 | guti += struct.pack("!L", m_tmsi)
1160 | return guti
1161 |
1162 | def encode_imsi(imsi):
1163 | imsi = str(imsi)
1164 | aux = unhexlify(imsi[0] + '9')
1165 | for i in range(1,15,2):
1166 | aux += unhexlify(imsi[i+1] + imsi[i])
1167 | return aux
1168 |
1169 | def encode_imei(imei):
1170 | imei = str(imei)
1171 | if len(imei) % 2 == 0:
1172 | imei += 'f'
1173 | aux = unhexlify(imei[0] + '3')
1174 | else:
1175 | aux = unhexlify(imei[0] + 'b')
1176 | for i in range(1,len(imei)-1,2):
1177 | aux += unhexlify(imei[i+1] + imei[i])
1178 | return aux
1179 |
--------------------------------------------------------------------------------
/images/application.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fasferraz/eNB/564252b4610e201ce0478ce93609b162ce9d9836/images/application.png
--------------------------------------------------------------------------------
/images/eNB.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fasferraz/eNB/564252b4610e201ce0478ce93609b162ce9d9836/images/eNB.png
--------------------------------------------------------------------------------
/images/eNB_open5gs_menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fasferraz/eNB/564252b4610e201ce0478ce93609b162ce9d9836/images/eNB_open5gs_menu.png
--------------------------------------------------------------------------------
/images/open5gs_eNB_setup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fasferraz/eNB/564252b4610e201ce0478ce93609b162ce9d9836/images/open5gs_eNB_setup.png
--------------------------------------------------------------------------------
/images/trace_4g_open5gs_eNB.pcapng:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fasferraz/eNB/564252b4610e201ce0478ce93609b162ce9d9836/images/trace_4g_open5gs_eNB.pcapng
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | pycryptodome
2 | requests
3 | smartcard
4 | git+https://github.com/pycrate-org/pycrate@master
5 | git+https://github.com/P1sec/pysctp@master
6 | git+https://github.com/P1sec/CryptoMobile@master
7 | git+https://github.com/mitshell/card@master
8 |
--------------------------------------------------------------------------------