Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
P
proxy-in-proxychains
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
proxy-in-proxychains
Commits
62aa6c9f
Commit
62aa6c9f
authored
Jun 16, 2017
by
Dan Carroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added argument for the bind address to use.
parent
9428ee96
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
proxy.c
proxy.c
+13
-4
No files found.
proxy.c
View file @
62aa6c9f
...
...
@@ -80,7 +80,7 @@ void plog(int priority, const char *format, ...);
int
server_sock
,
client_sock
,
remote_sock
,
remote_port
=
0
;
int
connections_processed
=
0
;
char
*
remote_host
,
*
cmd_in
,
*
cmd_out
;
char
*
bind_addr
,
*
remote_host
,
*
cmd_in
,
*
cmd_out
;
bool
foreground
=
FALSE
;
bool
use_syslog
=
FALSE
;
...
...
@@ -89,10 +89,12 @@ int main(int argc, char *argv[]) {
int
local_port
;
pid_t
pid
;
bind_addr
=
NULL
;
local_port
=
parse_options
(
argc
,
argv
);
if
(
local_port
<
0
)
{
printf
(
"Syntax: %s -l local_port -h remote_host -p remote_port [-i
\"
input parser
\"
] [-o
\"
output parser
\"
] [-f (stay in foreground)] [-s (use syslog)]
\n
"
,
argv
[
0
]);
printf
(
"Syntax: %s
[-b bind_address]
-l local_port -h remote_host -p remote_port [-i
\"
input parser
\"
] [-o
\"
output parser
\"
] [-f (stay in foreground)] [-s (use syslog)]
\n
"
,
argv
[
0
]);
return
local_port
;
}
...
...
@@ -132,11 +134,14 @@ int main(int argc, char *argv[]) {
int
parse_options
(
int
argc
,
char
*
argv
[])
{
int
c
,
local_port
=
0
;
while
((
c
=
getopt
(
argc
,
argv
,
"l:h:p:i:o:fs"
))
!=
-
1
)
{
while
((
c
=
getopt
(
argc
,
argv
,
"
b:
l:h:p:i:o:fs"
))
!=
-
1
)
{
switch
(
c
)
{
case
'l'
:
local_port
=
atoi
(
optarg
);
break
;
case
'b'
:
bind_addr
=
optarg
;
break
;
case
'h'
:
remote_host
=
optarg
;
break
;
...
...
@@ -181,7 +186,11 @@ int create_socket(int port) {
memset
(
&
server_addr
,
0
,
sizeof
(
server_addr
));
server_addr
.
sin_family
=
AF_INET
;
server_addr
.
sin_port
=
htons
(
port
);
if
(
bind_addr
==
NULL
)
{
server_addr
.
sin_addr
.
s_addr
=
INADDR_ANY
;
}
else
{
server_addr
.
sin_addr
.
s_addr
=
inet_addr
(
bind_addr
);
}
if
(
bind
(
server_sock
,
(
struct
sockaddr
*
)
&
server_addr
,
sizeof
(
server_addr
))
!=
0
)
{
return
SERVER_BIND_ERROR
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment