Package burp.api.montoya.proxy.http
Interface InterceptedRequest
- All Superinterfaces:
HttpMessage
,HttpRequest
,InterceptedHttpMessage
HTTP request intercepted by Burp Proxy.
-
Method Summary
Modifier and TypeMethodDescriptionbody()
Body of a message as a byte array.int
Offset within the message where the message body begins.Body of a message as aString
.boolean
Searches the data in the HTTP message for the specified search term.boolean
Searches the data in the HTTP message for the specified regular expression.Create a copy of theHttpRequest
in temporary file.
This method is used to save theHttpRequest
object to a temporary file, so that it is no longer held in memory.This method retrieves the IP address for the destination of the intercepted message.boolean
hasHeader
(HttpHeader header) boolean
boolean
boolean
hasParameter
(HttpParameter parameter) boolean
hasParameter
(String name, HttpParameterType type) boolean
boolean
headers()
HTTP headers contained in the message.headerValue
(String name) HTTP service for the request.HTTP Version text parsed from the request line for HTTP 1 messages.boolean
This method retrieves the name of the Burp Proxy listener that is processing the intercepted message.markers()
Markers for the message.int
This method retrieves a unique ID for this request/response.method()
HTTP method for the request.parameter
(String name, HttpParameterType type) parameters
(HttpParameterType type) parameterValue
(String name, HttpParameterType type) path()
Request path including the query parameters.Request path excluding the query parameters.This method retrieves the IP address for the source of the intercepted message.Message as a byte array.toString()
Message as aString
.url()
URL for the request.withAddedHeader
(HttpHeader header) Create a copy of theHttpRequest
with the added header.withAddedHeader
(String name, String value) Create a copy of theHttpRequest
with the added header.withAddedParameters
(HttpParameter... parameters) Create a copy of theHttpRequest
with the added HTTP parameters.withAddedParameters
(List<? extends HttpParameter> parameters) Create a copy of theHttpRequest
with the added HTTP parameters.Create a copy of theHttpRequest
with the updated body.
Updates Content-Length header.Create a copy of theHttpRequest
with the updated body.
Updates Content-Length header.Create a copy of theHttpRequest
with added default headers.withHeader
(HttpHeader header) Create a copy of theHttpRequest
with the added or updated header.
If the header exists in the request, it is updated.
If the header doesn't exist in the request, it is added.withHeader
(String name, String value) Create a copy of theHttpRequest
with the added or updated header.
If the header exists in the request, it is updated.
If the header doesn't exist in the request, it is added.withMarkers
(Marker... markers) Create a copy of theHttpRequest
with the added markers.withMarkers
(List<Marker> markers) Create a copy of theHttpRequest
with the added markers.withMethod
(String method) Create a copy of theHttpRequest
with the new method.withParameter
(HttpParameter parameters) Create a copy of theHttpRequest
with the HTTP parameter.
If the parameter exists in the request, it is updated.
If the parameter doesn't exist in the request, it is added.Create a copy of theHttpRequest
with the new path.withRemovedHeader
(HttpHeader header) Removes an existing HTTP header from the current request.withRemovedHeader
(String name) Removes an existing HTTP header from the current request.withRemovedParameters
(HttpParameter... parameters) Create a copy of theHttpRequest
with the removed HTTP parameters.withRemovedParameters
(List<? extends HttpParameter> parameters) Create a copy of theHttpRequest
with the removed HTTP parameters.withService
(HttpService service) Create a copy of theHttpRequest
with the new service.withTransformationApplied
(HttpTransformation transformation) Create a copy of theHttpRequest
with the transformation applied.withUpdatedHeader
(HttpHeader header) Create a copy of theHttpRequest
with the updated header.withUpdatedHeader
(String name, String value) Create a copy of theHttpRequest
with the updated header.withUpdatedParameters
(HttpParameter... parameters) Create a copy of theHttpRequest
with the updated HTTP parameters.withUpdatedParameters
(List<? extends HttpParameter> parameters) Create a copy of theHttpRequest
with the updated HTTP parameters.Methods inherited from interface burp.api.montoya.http.message.requests.HttpRequest
fileExtension, query, withAddedHeaders, withAddedHeaders, withRemovedHeaders, withRemovedHeaders, withUpdatedHeaders, withUpdatedHeaders
-
Method Details
-
annotations
Annotations annotations()- Returns:
- Annotations for request/response.
-
isInScope
boolean isInScope()- Specified by:
isInScope
in interfaceHttpRequest
- Returns:
- True if the request is in-scope.
-
httpService
HttpService httpService()HTTP service for the request.- Specified by:
httpService
in interfaceHttpRequest
- Returns:
- An
HttpService
object containing details of the HTTP service.
-
url
String url()URL for the request. If the request is malformed, then aMalformedRequestException
is thrown.- Specified by:
url
in interfaceHttpRequest
- Returns:
- The URL in the request.
- Throws:
MalformedRequestException
- if request is malformed.
-
method
String method()HTTP method for the request. If the request is malformed, then aMalformedRequestException
is thrown.- Specified by:
method
in interfaceHttpRequest
- Returns:
- The HTTP method used in the request.
- Throws:
MalformedRequestException
- if request is malformed.
-
path
String path()Request path including the query parameters. If the request is malformed, then aMalformedRequestException
is thrown.- Specified by:
path
in interfaceHttpRequest
- Returns:
- the path and query parameters.
- Throws:
MalformedRequestException
- if request is malformed.
-
pathWithoutQuery
String pathWithoutQuery()Request path excluding the query parameters. If the request is malformed, then aMalformedRequestException
is thrown.- Specified by:
pathWithoutQuery
in interfaceHttpRequest
- Returns:
- the path excluding query parameters.
- Throws:
MalformedRequestException
- if request is malformed.
-
httpVersion
String httpVersion()HTTP Version text parsed from the request line for HTTP 1 messages. HTTP 2 messages will return "HTTP/2"- Specified by:
httpVersion
in interfaceHttpMessage
- Specified by:
httpVersion
in interfaceHttpRequest
- Returns:
- Version string
-
headers
List<HttpHeader> headers()HTTP headers contained in the message.- Specified by:
headers
in interfaceHttpMessage
- Specified by:
headers
in interfaceHttpRequest
- Returns:
- A list of HTTP headers.
-
hasHeader
- Specified by:
hasHeader
in interfaceHttpMessage
- Specified by:
hasHeader
in interfaceHttpRequest
- Parameters:
header
- The header to check if it exists in the request.- Returns:
- True if the header exists in the request.
-
hasHeader
- Specified by:
hasHeader
in interfaceHttpMessage
- Specified by:
hasHeader
in interfaceHttpRequest
- Parameters:
name
- The name of the header to query within the request.- Returns:
- True if a header exists in the request with the supplied name.
-
hasHeader
- Specified by:
hasHeader
in interfaceHttpMessage
- Specified by:
hasHeader
in interfaceHttpRequest
- Parameters:
name
- The name of the header to check.value
- The value of the header to check.- Returns:
- True if a header exists in the request that matches the name and value supplied.
-
header
- Specified by:
header
in interfaceHttpMessage
- Specified by:
header
in interfaceHttpRequest
- Parameters:
name
- The name of the header to retrieve.- Returns:
- An instance of
HttpHeader
that matches the name supplied,null
if no match found.
-
headerValue
- Specified by:
headerValue
in interfaceHttpMessage
- Specified by:
headerValue
in interfaceHttpRequest
- Parameters:
name
- The name of the header to retrieve.- Returns:
- The
String
value of the header that matches the name supplied,null
if no match found.
-
hasParameters
boolean hasParameters()- Specified by:
hasParameters
in interfaceHttpRequest
- Returns:
- True if the request has parameters.
-
hasParameters
- Specified by:
hasParameters
in interfaceHttpRequest
- Returns:
- True if the request has parameters of type
HttpParameterType
-
parameter
- Specified by:
parameter
in interfaceHttpRequest
- Parameters:
name
- The name of the parameter to find.type
- The type of the parameter to find.- Returns:
- An instance of
ParsedHttpParameter
that matches the type and name specified.null
if not found.
-
parameterValue
- Specified by:
parameterValue
in interfaceHttpRequest
- Parameters:
name
- The name of the parameter to get the value from.type
- The type of the parameter to get the value from.- Returns:
- The value of the parameter that matches the name and type specified.
null
if not found.
-
hasParameter
- Specified by:
hasParameter
in interfaceHttpRequest
- Parameters:
name
- The name of the parameter to find.type
- The type of the parameter to find.- Returns:
true
if a parameter exists that matches the name and type specified.false
if not found.
-
hasParameter
- Specified by:
hasParameter
in interfaceHttpRequest
- Parameters:
parameter
- An instance ofHttpParameter
to match to an existing parameter.- Returns:
true
if a parameter exists that matches the data within the providedHttpParameter
.false
if not found.
-
contentType
ContentType contentType()- Specified by:
contentType
in interfaceHttpRequest
- Returns:
- The detected content type of the request.
-
parameters
List<ParsedHttpParameter> parameters()- Specified by:
parameters
in interfaceHttpRequest
- Returns:
- The parameters contained in the request.
-
parameters
- Specified by:
parameters
in interfaceHttpRequest
- Parameters:
type
- The type of parameter that will be returned in the filtered list.- Returns:
- A filtered list of
ParsedHttpParameter
containing only the provided type.
-
body
ByteArray body()Body of a message as a byte array.- Specified by:
body
in interfaceHttpMessage
- Specified by:
body
in interfaceHttpRequest
- Returns:
- The body of a message as a byte array.
-
bodyToString
String bodyToString()Body of a message as aString
.- Specified by:
bodyToString
in interfaceHttpMessage
- Specified by:
bodyToString
in interfaceHttpRequest
- Returns:
- The body of a message as a
String
.
-
bodyOffset
int bodyOffset()Offset within the message where the message body begins.- Specified by:
bodyOffset
in interfaceHttpMessage
- Specified by:
bodyOffset
in interfaceHttpRequest
- Returns:
- The message body offset.
-
markers
Markers for the message.- Specified by:
markers
in interfaceHttpMessage
- Specified by:
markers
in interfaceHttpRequest
- Returns:
- A list of markers.
-
contains
Searches the data in the HTTP message for the specified search term.- Specified by:
contains
in interfaceHttpMessage
- Specified by:
contains
in interfaceHttpRequest
- Parameters:
searchTerm
- The value to be searched for.caseSensitive
- Flags whether the search is case-sensitive.- Returns:
- True if the search term is found.
-
contains
Searches the data in the HTTP message for the specified regular expression.- Specified by:
contains
in interfaceHttpMessage
- Specified by:
contains
in interfaceHttpRequest
- Parameters:
pattern
- The regular expression to be searched for.- Returns:
- True if the pattern is matched.
-
toByteArray
ByteArray toByteArray()Message as a byte array.- Specified by:
toByteArray
in interfaceHttpMessage
- Specified by:
toByteArray
in interfaceHttpRequest
- Returns:
- The message as a byte array.
-
toString
String toString()Message as aString
.- Specified by:
toString
in interfaceHttpMessage
- Specified by:
toString
in interfaceHttpRequest
- Overrides:
toString
in classObject
- Returns:
- The message as a
String
.
-
copyToTempFile
HttpRequest copyToTempFile()Create a copy of theHttpRequest
in temporary file.
This method is used to save theHttpRequest
object to a temporary file, so that it is no longer held in memory. Extensions can use this method to convertHttpRequest
objects into a form suitable for long-term usage.- Specified by:
copyToTempFile
in interfaceHttpRequest
- Returns:
- A new
HttpRequest
instance stored in temporary file.
-
withService
Create a copy of theHttpRequest
with the new service.- Specified by:
withService
in interfaceHttpRequest
- Parameters:
service
- AnHttpService
reference to add.- Returns:
- A new
HttpRequest
instance.
-
withPath
Create a copy of theHttpRequest
with the new path.- Specified by:
withPath
in interfaceHttpRequest
- Parameters:
path
- The path to use.- Returns:
- A new
HttpRequest
instance with updated path.
-
withMethod
Create a copy of theHttpRequest
with the new method.- Specified by:
withMethod
in interfaceHttpRequest
- Parameters:
method
- the method to use- Returns:
- a new
HttpRequest
instance with updated method.
-
withHeader
Create a copy of theHttpRequest
with the added or updated header.
If the header exists in the request, it is updated.
If the header doesn't exist in the request, it is added.- Specified by:
withHeader
in interfaceHttpRequest
- Parameters:
header
- HTTP header to add or update.- Returns:
- A new
HttpRequest
with the added or updated header.
-
withHeader
Create a copy of theHttpRequest
with the added or updated header.
If the header exists in the request, it is updated.
If the header doesn't exist in the request, it is added.- Specified by:
withHeader
in interfaceHttpRequest
- Parameters:
name
- The name of the header.value
- The value of the header.- Returns:
- A new
HttpRequest
with the added or updated header.
-
withParameter
Create a copy of theHttpRequest
with the HTTP parameter.
If the parameter exists in the request, it is updated.
If the parameter doesn't exist in the request, it is added.- Specified by:
withParameter
in interfaceHttpRequest
- Parameters:
parameters
- HTTP parameter to add or update.- Returns:
- A new
HttpRequest
with the added or updated parameter.
-
withAddedParameters
Create a copy of theHttpRequest
with the added HTTP parameters.- Specified by:
withAddedParameters
in interfaceHttpRequest
- Parameters:
parameters
- HTTP parameters to add.- Returns:
- A new
HttpRequest
instance.
-
withAddedParameters
Create a copy of theHttpRequest
with the added HTTP parameters.- Specified by:
withAddedParameters
in interfaceHttpRequest
- Parameters:
parameters
- HTTP parameters to add.- Returns:
- A new
HttpRequest
instance.
-
withRemovedParameters
Create a copy of theHttpRequest
with the removed HTTP parameters.- Specified by:
withRemovedParameters
in interfaceHttpRequest
- Parameters:
parameters
- HTTP parameters to remove.- Returns:
- A new
HttpRequest
instance.
-
withRemovedParameters
Create a copy of theHttpRequest
with the removed HTTP parameters.- Specified by:
withRemovedParameters
in interfaceHttpRequest
- Parameters:
parameters
- HTTP parameters to remove.- Returns:
- A new
HttpRequest
instance.
-
withUpdatedParameters
Create a copy of theHttpRequest
with the updated HTTP parameters.- Specified by:
withUpdatedParameters
in interfaceHttpRequest
- Parameters:
parameters
- HTTP parameters to update.- Returns:
- A new
HttpRequest
instance.
-
withUpdatedParameters
Create a copy of theHttpRequest
with the updated HTTP parameters.- Specified by:
withUpdatedParameters
in interfaceHttpRequest
- Parameters:
parameters
- HTTP parameters to update.- Returns:
- A new
HttpRequest
instance.
-
withTransformationApplied
Create a copy of theHttpRequest
with the transformation applied.- Specified by:
withTransformationApplied
in interfaceHttpRequest
- Parameters:
transformation
- Transformation to apply.- Returns:
- A new
HttpRequest
instance.
-
withBody
Create a copy of theHttpRequest
with the updated body.
Updates Content-Length header.- Specified by:
withBody
in interfaceHttpRequest
- Parameters:
body
- the new body for the request- Returns:
- A new
HttpRequest
instance.
-
withBody
Create a copy of theHttpRequest
with the updated body.
Updates Content-Length header.- Specified by:
withBody
in interfaceHttpRequest
- Parameters:
body
- the new body for the request- Returns:
- A new
HttpRequest
instance.
-
withAddedHeader
Create a copy of theHttpRequest
with the added header.- Specified by:
withAddedHeader
in interfaceHttpRequest
- Parameters:
name
- The name of the header.value
- The value of the header.- Returns:
- The updated HTTP request with the added header.
-
withAddedHeader
Create a copy of theHttpRequest
with the added header.- Specified by:
withAddedHeader
in interfaceHttpRequest
- Parameters:
header
- TheHttpHeader
to add to the HTTP request.- Returns:
- The updated HTTP request with the added header.
-
withUpdatedHeader
Create a copy of theHttpRequest
with the updated header.- Specified by:
withUpdatedHeader
in interfaceHttpRequest
- Parameters:
name
- The name of the header to update the value of.value
- The new value of the specified HTTP header.- Returns:
- The updated request containing the updated header.
-
withUpdatedHeader
Create a copy of theHttpRequest
with the updated header.- Specified by:
withUpdatedHeader
in interfaceHttpRequest
- Parameters:
header
- TheHttpHeader
to update containing the new value.- Returns:
- The updated request containing the updated header.
-
withRemovedHeader
Removes an existing HTTP header from the current request.- Specified by:
withRemovedHeader
in interfaceHttpRequest
- Parameters:
name
- The name of the HTTP header to remove from the request.- Returns:
- The updated request containing the removed header.
-
withRemovedHeader
Removes an existing HTTP header from the current request.- Specified by:
withRemovedHeader
in interfaceHttpRequest
- Parameters:
header
- TheHttpHeader
to remove from the request.- Returns:
- The updated request containing the removed header.
-
withMarkers
Create a copy of theHttpRequest
with the added markers.- Specified by:
withMarkers
in interfaceHttpRequest
- Parameters:
markers
- Request markers to add.- Returns:
- A new
HttpRequest
instance.
-
withMarkers
Create a copy of theHttpRequest
with the added markers.- Specified by:
withMarkers
in interfaceHttpRequest
- Parameters:
markers
- Request markers to add.- Returns:
- A new
HttpRequest
instance.
-
withDefaultHeaders
HttpRequest withDefaultHeaders()Create a copy of theHttpRequest
with added default headers.- Specified by:
withDefaultHeaders
in interfaceHttpRequest
- Returns:
- a new
HttpRequest
with added default headers
-
messageId
int messageId()This method retrieves a unique ID for this request/response.- Specified by:
messageId
in interfaceInterceptedHttpMessage
- Returns:
- An identifier that is unique to a single request/response pair. Extensions can use this to correlate details of requests and responses and perform processing on the response message accordingly.
-
listenerInterface
String listenerInterface()This method retrieves the name of the Burp Proxy listener that is processing the intercepted message.- Specified by:
listenerInterface
in interfaceInterceptedHttpMessage
- Returns:
- The name of the Burp Proxy listener that is processing the intercepted message. The format is the same as that shown in the Proxy Listeners UI - for example, "127.0.0.1:8080".
-
sourceIpAddress
InetAddress sourceIpAddress()This method retrieves the IP address for the source of the intercepted message.- Specified by:
sourceIpAddress
in interfaceInterceptedHttpMessage
- Returns:
- The IP address for the source of the intercepted message.
-
destinationIpAddress
InetAddress destinationIpAddress()This method retrieves the IP address for the destination of the intercepted message.- Specified by:
destinationIpAddress
in interfaceInterceptedHttpMessage
- Returns:
- The IP address for the destination of the intercepted message.
-