IP Library Granted Patent US 12,399,757
Granted Patent B2
US 12,399,757 · App. 18/013,873 · Granted Aug 26, 2025

Rest interface specification encapsulation system based on network sniffing

Inventors: Zitong Yang (Hangzhou, CN); Jianwei Yin (Hangzhou, CN)
Assignee: ZHEJIANG UNIVERSITY
G06F9/54H04L63/0823G06F2209/547
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,399,757
App. No.
18/013,873
Granted
Aug 26, 2025
Kind
B2
Abstract

The present invention discloses a REST interface specification encapsulation system based on network sniffing, comprising: an API traffic sniffing module, an API specification extraction module and an API sharing platform module. The API traffic sniffing module realizes the interception and analysis of the API call traffic in mobile applications based on the principle of Man-in-the-Middle Attack. The API specification extraction module is responsible for filtering and classifying the intercepted API call collection, and automatically generating the API specification in JSON HyperSchema format. The API sharing platform module implements sharing, openness and display of the API specification with JSON HYPERSCHEMA as the core, and provides sharing permission control, search, API call test, and API specification error correction function, the REST interface specification encapsulation system improves the efficiency and accuracy of API specification extraction, and the encapsulation system is versatility and practical.

Claims (194)

1. A Representational State Transfer (REST) interface specification encapsulation system based on network sniffing, comprising:

an application interface (API) traffic sniffing module including a mobile terminal and a Man-in-the-Middle Attack server, wherein the API traffic sniffing module intercepts API call traffic in mobile applications based on the principle of a Man-in-the-Middle Attack;

an API specification extraction module, wherein the API specification extraction module automatically generates an API specification in JSON HyperSchema format, and wherein the API specification extraction module includes:

a JSON type derivation sub module associated with a JSON type,

an API clustering sub module associated with a JSON type similarity and a URL similarity, wherein the JSON type similarity and the URL similarity are based on a formal description of JSON types, and wherein the API clustering sub module is associated with multiple API sample clusters; and

an API specification generation sub module associated with common attributes of APIs from each of the multiple API sample clusters, wherein the API specification generation sub module generates an API model and outputs an API specification in JSON HyperSchema format as an input to an API sharing platform module according to the API model; and

the API sharing platform module, wherein the API sharing platform module displays the API specification with the JSON HyperSchema format and provides sharing permission control, search, API call test, and API specification error correction functions.

2. The REST interface specification encapsulation system based on network sniffing according to claim 1 ,

wherein the mobile terminal is embedded with a self-signed root certificate;

wherein the Man-in-the-Middle Attack server has a private key of the self-signed root certificate;

wherein the Man-in-the-Middle Attack server interacts with an API specification encapsulation user;

wherein the API specification encapsulation user operates a mobile application at the mobile terminal to generate API call traffic;

wherein the mobile terminal forwards the API call traffic to the Man-in-the-Middle Attack server;

wherein the Man-in-the-Middle Attack server and the mobile terminal complete a SSL handshake and send the API call traffic to a target application server;

wherein the Man-in-the-Middle Attack server forwards a response to the mobile terminal from the target application server; and

wherein the API call traffic intercepted by the API traffic sniffing module is an input to the API specification extraction module.

3. The REST interface specification encapsulation system based on network sniffing according to claim 1 ,

wherein, when constructing the API traffic sniffing module, the Man-in-the-Middle Attack server is installed at the same time as performing a Certificate Authority (CA) certificate installation and a network configuration;

wherein executing the Man-in-the-Middle Attack server implements sniffing of the API call traffic;

wherein results of the API traffic sniffing module are represented in the form of data columns, specifically including API request time, HTTP method, protocol, IP address, request path, status code, return result type, return result size, and request duration.

4. The REST interface specification encapsulation system based on network sniffing according to claim 1 , wherein, the formal description of JSON types is:

Type::=Primitive|Composite|Union

Primitive::=Null|Boolean|Number|String

Composite::=Object|Array

Union::=(Type+Type)

Object::={k1:T1, k2:T2, . . . , kn:Tn}

Array::=[T1, T2, . . . , Tn]

RArray::=[Type*]

wherein, a root type Type includes basic type Primitive, composite type Composite and combined type Union; the basic type Primitive includes Null, Boolean, Number and String; the composite type Composite includes a universal key value pair-pair type Object and an orderly list type Array; RArray is a streamlined expression of Array; kn is a string type String; and [T1, T2, . . . , Tn] indicates a sequence.

5. The REST interface specification encapsulation system based on network sniffing according to claim 1 , wherein the API clustering sub module is associated with:

(a) a URL similarity of the API call traffic based on a weighted sum of a URL path similarity and a query similarity;

(b) a JSON type similarity based on a JSON type expression;

(c) an API similarity between two API call traffic, the JSON type similarity, and the URL similarity; and

(d) a layer cluster algorithm that requires a distance matrix based on the API similarity.

6. The REST interface specification encapsulation system based on network sniffing according to claim 5 ,

wherein, the URL similarity is expressed as usim=wp×psim+wq×qsim, wherein path similarity and query similarity are expressed as psim and qsim respectively, and their weights are wp and wq respectively;

for the path similarity psim, two URLs have a total of N-pair paths, each sub path score of at least one sub path score is scored si, and each pair of sub paths of at least one pair of sub paths has a score based on whether it belongs to different types, and the path similarity is expressed as:

psim

=

1

10

n

i

=

1

n

s

i

;

and for the query similarity qsim, the form of each query of at least one query in a URL is key=value, wherein a set of keys in the query similarity of URL1 and URL2 of the two URLs is expressed as U 1 key and U 2 key , and wherein the query similarity qsim is expressed as:

qsim

=

"\[LeftBracketingBar]"

U

key

1

U

key

2

"\[RightBracketingBar]"

"\[LeftBracketingBar]"

U

key

1

U

key

2

|

.

7. The REST interface specification encapsulation system based on network sniffing according to claim 5 , wherein, the the REST interface specification encapsulation system based on network sniffing is associated with an amount of information of the JSON type expression, upper and lower bounds of the amount of information, and a growth rate dist to represent a JSON type distance, and wherein the growth rate dist dist (T 1 , T 2 ) and a JSON type similarity sim sim (T 1 , T 2 ) are respectively expressed as:

dist

(

T

1

,

T

2

)

=

"\[LeftBracketingBar]"

T

1

T

2

"\[RightBracketingBar]"

-

max

(

"\[LeftBracketingBar]"

T

1

"\[RightBracketingBar]"

,

"\[LeftBracketingBar]"

T

2

"\[RightBracketingBar]"

)

min

(

"\[LeftBracketingBar]"

T

1

"\[RightBracketingBar]"

,

"\[LeftBracketingBar]"

T

2

"\[RightBracketingBar]"

)

sim

(

T

1

,

T

2

)

=

1

-

"\[LeftBracketingBar]"

T

1

T

2

"\[RightBracketingBar]"

-

max

(

"\[LeftBracketingBar]"

T

1

"\[RightBracketingBar]"

,

"\[LeftBracketingBar]"

T

2

"\[RightBracketingBar]"

)

min

(

"\[LeftBracketingBar]"

T

1

"\[RightBracketingBar]"

,

"\[LeftBracketingBar]"

T

2

"\[RightBracketingBar]"

)

.

8. The REST interface specification encapsulation system based on network sniffing according to claim 1 , wherein the API sharing platform module includes:

an API document generation sub module, wherein the API document generation sub module converts JSON HyperSchema documents into human-readable API documents;

an API information retrieval sub module, wherein the API information retrieval sub module retrieves API information stored in the API sharing platform module;

an API test verification sub module, wherein the API test verification sub module is associated with a verification of whether an API interface address and request information entered by the API specification encapsulation user conform to the API specification and whether the API specification fully conforms to an actual call of the API; and

a system information management sub module, wherein the system information management sub module manages user information, permission information, API information, and log information in the API sharing platform module, and interacts with a database to complete a persistent operation.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Dec 29, 2022
From: YANG, ZITONG; YIN, JIANWEI
To: ZHEJIANG UNIVERSITY
Reel/Frame 062251/0744 →
Priority Claims (1)
CN 202110558445.1 · May 21, 2021 · national
Continuity (1)
Related Publication 20230305907A1 · Sep 28, 2023
References Cited (6)
US 10747505B1 · Lester et al. · 2020 [cited by applicant]
US 11095774B1 · Willshire · 2021 [cited by examiner]
US 20070055711A1 · Polyakov · 2007 [cited by examiner]
US 20200320203A1 · Ting · 2020 [cited by examiner]
CN 107301137 · 2017 [cited by applicant]
CN 110224990 · 2019 [cited by applicant]