mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 07:08:10 +00:00
apply suggested changes
This commit is contained in:
parent
96d6804f5a
commit
ccb48f3cc3
@ -381,17 +381,6 @@ class FDst(_Rex):
|
||||
return f.server_conn.address and self.re.search(r)
|
||||
|
||||
|
||||
class FDstIP(_Rex):
|
||||
code = "ip"
|
||||
help = "Match destination ip address"
|
||||
is_binary = False
|
||||
|
||||
def __call__(self, f):
|
||||
if not f.server_conn or not f.server_conn.ip_address:
|
||||
return False
|
||||
return f.server_conn.ip_address and self.re.search(f.server_conn.ip_address[0])
|
||||
|
||||
|
||||
class FReplay(_Action):
|
||||
code = "replay"
|
||||
help = "Match replayed flows"
|
||||
@ -525,7 +514,6 @@ filter_rex: Sequence[Type[_Rex]] = [
|
||||
FContentTypeResponse,
|
||||
FDomain,
|
||||
FDst,
|
||||
FDstIP,
|
||||
FHead,
|
||||
FHeadRequest,
|
||||
FHeadResponse,
|
||||
|
@ -35,24 +35,18 @@ class HoverMenu extends Component {
|
||||
<i className="fa fa-fw fa-plus"></i>
|
||||
Intercept {flow.request.host}
|
||||
</a>
|
||||
<a href="#" onClick={(e) =>{
|
||||
{ flow.request.path != "/" ? <a href="#" onClick={(e) =>{
|
||||
this.onClick(e, flow.request.host + flow.request.path)
|
||||
}}>
|
||||
<i className="fa fa-fw fa-plus"></i>
|
||||
Intercept {flow.request.host + flow.request.path}
|
||||
</a>
|
||||
</a> : null }
|
||||
<a href="#" onClick={(e) =>{
|
||||
this.onClick(e, `~m POST & ${flow.request.host}`)
|
||||
}}>
|
||||
<i className="fa fa-fw fa-plus"></i>
|
||||
Intercept all POST requests from this host
|
||||
</a>
|
||||
<a href="#" onClick={(e) =>{
|
||||
this.onClick(e, `~ip ${flow.server_conn.ip_address[0]}`)
|
||||
}}>
|
||||
<i className="fa fa-fw fa-plus"></i>
|
||||
Intercept all requests from {flow.server_conn.ip_address[0]}
|
||||
</a>
|
||||
</Dropdown>
|
||||
)
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ export default class FilterInput extends Component {
|
||||
this.selectFilter = this.selectFilter.bind(this)
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
UNSAFE_componentWillReceiveProps(nextProps) {
|
||||
this.setState({ value: nextProps.value })
|
||||
}
|
||||
|
||||
|
@ -11,11 +11,11 @@ import Modal from './Modal/Modal'
|
||||
|
||||
class ProxyAppMain extends Component {
|
||||
|
||||
componentWillMount() {
|
||||
componentDidMount() {
|
||||
window.addEventListener('keydown', this.props.onKeyDown);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
UNSAFE_componentWillUnmount() {
|
||||
window.removeEventListener('keydown', this.props.onKeyDown);
|
||||
}
|
||||
|
||||
|
@ -111,16 +111,6 @@ function destination(regex){
|
||||
destinationFilter.desc = "destination address matches " + regex;
|
||||
return destinationFilter;
|
||||
}
|
||||
function ip(regex) {
|
||||
regex = new RegExp(regex, "i");
|
||||
function ipFilter(flow){
|
||||
return (!!flow.server_conn.ip_address)
|
||||
&&
|
||||
regex.test(flow.server_conn.ip_address[0] + ":" + flow.server_conn.ip_address[1]);
|
||||
}
|
||||
ipFilter.desc = "destination ip address matches " + regex;
|
||||
return ipFilter;
|
||||
}
|
||||
function errorFilter(flow){
|
||||
return !!flow.error;
|
||||
}
|
||||
@ -277,7 +267,6 @@ Expr
|
||||
/ "~c" ws+ s:IntegerLiteral { return responseCode(s); }
|
||||
/ "~d" ws+ s:StringLiteral { return domain(s); }
|
||||
/ "~dst" ws+ s:StringLiteral { return destination(s); }
|
||||
/ "~ip" ws+ s:StringLiteral { return ip(s); }
|
||||
/ "~e" { return errorFilter; }
|
||||
/ "~h" ws+ s:StringLiteral { return header(s); }
|
||||
/ "~hq" ws+ s:StringLiteral { return requestHeader(s); }
|
||||
|
Loading…
Reference in New Issue
Block a user