Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
browser-backend
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
browser-backend
Commits
a0405b6f
Commit
a0405b6f
authored
May 06, 2020
by
renjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.ip添加专线字段
2.提现bug
parent
5a80bad5
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
175 additions
and
42 deletions
+175
-42
AccountController.java
.../browserbackend/account/controller/AccountController.java
+1
-1
AdministratorController.java
...erbackend/account/controller/AdministratorController.java
+1
-1
AccountRepository.java
.../browserbackend/account/repository/AccountRepository.java
+1
-1
AccountRepositoryCustom.java
...erbackend/account/repository/AccountRepositoryCustom.java
+0
-2
AccountRepositoryCustomImpl.java
...ckend/account/repository/AccountRepositoryCustomImpl.java
+0
-14
AdministratorService.java
.../browserbackend/account/service/AdministratorService.java
+1
-1
PaymentService.java
.../edgec/browserbackend/account/service/PaymentService.java
+1
-1
AdministratorServiceImpl.java
...ackend/account/service/impl/AdministratorServiceImpl.java
+4
-4
PaymentServiceImpl.java
...owserbackend/account/service/impl/PaymentServiceImpl.java
+1
-1
IpResource.java
...a/com/edgec/browserbackend/browser/domain/IpResource.java
+23
-1
IpResourceDto.java
...a/com/edgec/browserbackend/browser/dto/IpResourceDto.java
+52
-0
Set3proxyTask.java
.../com/edgec/browserbackend/browser/task/Set3proxyTask.java
+36
-0
RemoteShellExecutor.java
...wserbackend/common/commons/utils/RemoteShellExecutor.java
+54
-15
No files found.
src/main/java/com/edgec/browserbackend/account/controller/AccountController.java
View file @
a0405b6f
...
@@ -461,7 +461,7 @@ public class AccountController {
...
@@ -461,7 +461,7 @@ public class AccountController {
}
}
@RequestMapping
(
path
=
"/ali/withdraw"
,
method
=
RequestMethod
.
PUT
)
@RequestMapping
(
path
=
"/ali/withdraw"
,
method
=
RequestMethod
.
PUT
)
public
ResultDto
alipayWithdraw
(
Principal
principal
,
@RequestParam
(
"account"
)
String
account
,
@RequestParam
(
"realName"
)
String
realName
,
@RequestParam
(
"amount"
)
int
amount
)
{
public
ResultDto
alipayWithdraw
(
Principal
principal
,
@RequestParam
(
"account"
)
String
account
,
@RequestParam
(
"realName"
)
String
realName
,
@RequestParam
(
"amount"
)
double
amount
)
{
// //获取支付宝GET过来反馈信息
// //获取支付宝GET过来反馈信息
// Map<String,String> params = new HashMap<String,String>();
// Map<String,String> params = new HashMap<String,String>();
// Map requestParams = request.getParameterMap();
// Map requestParams = request.getParameterMap();
...
...
src/main/java/com/edgec/browserbackend/account/controller/AdministratorController.java
View file @
a0405b6f
...
@@ -181,7 +181,7 @@ public class AdministratorController {
...
@@ -181,7 +181,7 @@ public class AdministratorController {
//查询某时段内增加的用户
//查询某时段内增加的用户
@PreAuthorize
(
"hasRole('ADMIN')"
)
@PreAuthorize
(
"hasRole('ADMIN')"
)
@RequestMapping
(
path
=
"/0xadministrator/searchperioduser"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/0xadministrator/searchperioduser"
,
method
=
RequestMethod
.
GET
)
public
Page
<
Account
>
searchCreateAccount
(
@RequestParam
(
value
=
"page"
)
int
page
,
@RequestParam
(
value
=
"size"
)
int
size
,
@RequestParam
(
value
=
"strDate1"
)
String
strDate1
,
@RequestParam
(
value
=
"strDate2"
)
String
strDate2
,
@RequestParam
(
"isAuthorized"
)
boolean
isAuthorized
){
public
Page
<
Account
>
searchCreateAccount
(
@RequestParam
(
value
=
"page"
)
int
page
,
@RequestParam
(
value
=
"size"
)
int
size
,
@RequestParam
(
value
=
"strDate1"
)
String
strDate1
,
@RequestParam
(
value
=
"strDate2"
)
String
strDate2
,
@RequestParam
(
value
=
"isAuthorized"
,
defaultValue
=
"5"
)
int
isAuthorized
){
Pageable
pageable
=
PageRequest
.
of
(
page
,
size
);
Pageable
pageable
=
PageRequest
.
of
(
page
,
size
);
return
administratorService
.
searchCreateAccountBetween
(
pageable
,
strDate1
,
strDate2
,
isAuthorized
);
return
administratorService
.
searchCreateAccountBetween
(
pageable
,
strDate1
,
strDate2
,
isAuthorized
);
}
}
...
...
src/main/java/com/edgec/browserbackend/account/repository/AccountRepository.java
View file @
a0405b6f
...
@@ -35,7 +35,7 @@ public interface AccountRepository extends MongoRepository<Account, String>, Acc
...
@@ -35,7 +35,7 @@ public interface AccountRepository extends MongoRepository<Account, String>, Acc
Page
<
Account
>
findAllBySignupDateBetweenAndParentIsNull
(
Pageable
pageable
,
Date
startDate
,
Date
endDate
);
Page
<
Account
>
findAllBySignupDateBetweenAndParentIsNull
(
Pageable
pageable
,
Date
startDate
,
Date
endDate
);
Page
<
Account
>
findAllBySignupDateBetweenAndParentIsNullAndAuthorized
Not
(
Pageable
pageable
,
Date
startDate
,
Date
endDate
,
int
authorized
);
Page
<
Account
>
findAllBySignupDateBetweenAndParentIsNullAndAuthorized
(
Pageable
pageable
,
Date
startDate
,
Date
endDate
,
int
authorized
);
Page
<
Account
>
findAll
(
Pageable
pageable
);
Page
<
Account
>
findAll
(
Pageable
pageable
);
...
...
src/main/java/com/edgec/browserbackend/account/repository/AccountRepositoryCustom.java
View file @
a0405b6f
...
@@ -8,8 +8,6 @@ public interface AccountRepositoryCustom {
...
@@ -8,8 +8,6 @@ public interface AccountRepositoryCustom {
List
<
String
>
findInName
(
String
[]
name
);
List
<
String
>
findInName
(
String
[]
name
);
List
<
String
>
findParents
(
List
<
String
>
names
);
void
updateRealNameAndIdCard
(
String
username
,
String
realName
,
String
idCard
);
void
updateRealNameAndIdCard
(
String
username
,
String
realName
,
String
idCard
);
Account
findByPromotion
(
String
code
);
Account
findByPromotion
(
String
code
);
...
...
src/main/java/com/edgec/browserbackend/account/repository/AccountRepositoryCustomImpl.java
View file @
a0405b6f
...
@@ -9,7 +9,6 @@ import org.springframework.data.mongodb.core.aggregation.AggregationResults;
...
@@ -9,7 +9,6 @@ import org.springframework.data.mongodb.core.aggregation.AggregationResults;
import
org.springframework.data.mongodb.core.aggregation.MatchOperation
;
import
org.springframework.data.mongodb.core.aggregation.MatchOperation
;
import
org.springframework.data.mongodb.core.aggregation.ProjectionOperation
;
import
org.springframework.data.mongodb.core.aggregation.ProjectionOperation
;
import
org.springframework.data.mongodb.core.query.BasicQuery
;
import
org.springframework.data.mongodb.core.query.BasicQuery
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Update
;
import
org.springframework.data.mongodb.core.query.Update
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -42,19 +41,6 @@ public class AccountRepositoryCustomImpl implements AccountRepositoryCustom {
...
@@ -42,19 +41,6 @@ public class AccountRepositoryCustomImpl implements AccountRepositoryCustom {
return
accountTelephones
;
return
accountTelephones
;
}
}
@Override
public
List
<
String
>
findParents
(
List
<
String
>
names
)
{
Document
query
=
new
Document
();
Document
fields
=
new
Document
();
fields
.
put
(
"name"
,
1
);
BasicQuery
basicQuery
=
new
BasicQuery
(
query
,
fields
);
Criteria
criteria
=
new
Criteria
();
basicQuery
.
addCriteria
(
criteria
.
orOperator
(
where
(
"name"
).
in
(
names
)));
return
null
;
}
@Override
@Override
public
void
updateRealNameAndIdCard
(
String
username
,
String
realName
,
String
idCard
)
{
public
void
updateRealNameAndIdCard
(
String
username
,
String
realName
,
String
idCard
)
{
Document
doc
=
new
Document
();
Document
doc
=
new
Document
();
...
...
src/main/java/com/edgec/browserbackend/account/service/AdministratorService.java
View file @
a0405b6f
...
@@ -38,7 +38,7 @@ public interface AdministratorService {
...
@@ -38,7 +38,7 @@ public interface AdministratorService {
Page
<
UserPrePaidBilling
>
searchAllUserBillingPage
(
int
page
,
int
year1
,
int
month1
,
int
year2
,
int
month2
);
Page
<
UserPrePaidBilling
>
searchAllUserBillingPage
(
int
page
,
int
year1
,
int
month1
,
int
year2
,
int
month2
);
Page
<
Account
>
searchCreateAccountBetween
(
Pageable
pageable
,
String
strDate1
,
String
strDate2
,
boolean
isAuthorized
);
Page
<
Account
>
searchCreateAccountBetween
(
Pageable
pageable
,
String
strDate1
,
String
strDate2
,
int
isAuthorized
);
List
<
UserPrePaidBilling
>
getServiceFeeOwedUserInfo
();
List
<
UserPrePaidBilling
>
getServiceFeeOwedUserInfo
();
...
...
src/main/java/com/edgec/browserbackend/account/service/PaymentService.java
View file @
a0405b6f
...
@@ -22,7 +22,7 @@ public interface PaymentService {
...
@@ -22,7 +22,7 @@ public interface PaymentService {
UserPaymentDto
h5wxPayOrder
(
String
ip
,
String
username
,
int
amount
);
UserPaymentDto
h5wxPayOrder
(
String
ip
,
String
username
,
int
amount
);
boolean
alipayWithdraw
(
String
username
,
String
account
,
String
realName
,
int
amount
);
boolean
alipayWithdraw
(
String
username
,
String
account
,
String
realName
,
double
amount
);
public
UserPaymentDto
wxCheckOrderStatus
(
String
tradeno
);
public
UserPaymentDto
wxCheckOrderStatus
(
String
tradeno
);
...
...
src/main/java/com/edgec/browserbackend/account/service/impl/AdministratorServiceImpl.java
View file @
a0405b6f
...
@@ -225,16 +225,16 @@ public class AdministratorServiceImpl implements AdministratorService {
...
@@ -225,16 +225,16 @@ public class AdministratorServiceImpl implements AdministratorService {
}
}
@Override
@Override
public
Page
<
Account
>
searchCreateAccountBetween
(
Pageable
pageable
,
String
strDate1
,
String
strDate2
,
boolean
isAuthorized
)
{
public
Page
<
Account
>
searchCreateAccountBetween
(
Pageable
pageable
,
String
strDate1
,
String
strDate2
,
int
isAuthorized
)
{
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Page
<
Account
>
accounts
=
null
;
Page
<
Account
>
accounts
=
null
;
try
{
try
{
Date
dateTime1
=
formatter
.
parse
(
strDate1
);
Date
dateTime1
=
formatter
.
parse
(
strDate1
);
Date
dateTime2
=
formatter
.
parse
(
strDate2
);
Date
dateTime2
=
formatter
.
parse
(
strDate2
);
if
(
isAuthorized
)
if
(
isAuthorized
==
5
)
accounts
=
accountRepository
.
findAllBySignupDateBetweenAndParentIsNullAndAuthorizedNot
(
pageable
,
dateTime1
,
dateTime2
,
0
);
else
accounts
=
accountRepository
.
findAllBySignupDateBetweenAndParentIsNull
(
pageable
,
dateTime1
,
dateTime2
);
accounts
=
accountRepository
.
findAllBySignupDateBetweenAndParentIsNull
(
pageable
,
dateTime1
,
dateTime2
);
else
accounts
=
accountRepository
.
findAllBySignupDateBetweenAndParentIsNullAndAuthorized
(
pageable
,
dateTime1
,
dateTime2
,
isAuthorized
);
}
catch
(
ParseException
e
){
}
catch
(
ParseException
e
){
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
...
src/main/java/com/edgec/browserbackend/account/service/impl/PaymentServiceImpl.java
View file @
a0405b6f
...
@@ -590,7 +590,7 @@ public class PaymentServiceImpl implements PaymentService {
...
@@ -590,7 +590,7 @@ public class PaymentServiceImpl implements PaymentService {
}
}
@Override
@Override
public
boolean
alipayWithdraw
(
String
username
,
String
account
,
String
realName
,
int
amount
)
{
public
boolean
alipayWithdraw
(
String
username
,
String
account
,
String
realName
,
double
amount
)
{
Account
byName
=
accountService
.
findByName
(
username
);
Account
byName
=
accountService
.
findByName
(
username
);
if
(
byName
==
null
)
if
(
byName
==
null
)
throw
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
,
"account does not exist: "
+
username
);
throw
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
,
"account does not exist: "
+
username
);
...
...
src/main/java/com/edgec/browserbackend/browser/domain/IpResource.java
View file @
a0405b6f
...
@@ -36,8 +36,12 @@ public class IpResource implements Serializable {
...
@@ -36,8 +36,12 @@ public class IpResource implements Serializable {
private
String
password
;
private
String
password
;
private
double
price
;
private
double
price
;
private
boolean
specialLine
;
//专线数据
private
String
proxyUsername
;
private
String
proxyUsername
;
private
String
proxyPassword
;
private
String
proxyPassword
;
private
String
proxyprotocol
;
private
String
proxyport
;
private
String
shopId
;
private
String
shopId
;
private
String
shopName
;
private
String
shopName
;
...
@@ -48,7 +52,8 @@ public class IpResource implements Serializable {
...
@@ -48,7 +52,8 @@ public class IpResource implements Serializable {
private
String
unit
;
private
String
unit
;
private
int
period
;
private
int
period
;
private
boolean
specialLine
;
public
IpResource
()
{
}
public
String
getDetails
()
{
public
String
getDetails
()
{
return
details
;
return
details
;
...
@@ -281,4 +286,21 @@ public class IpResource implements Serializable {
...
@@ -281,4 +286,21 @@ public class IpResource implements Serializable {
public
void
setSpecialLine
(
boolean
specialLine
)
{
public
void
setSpecialLine
(
boolean
specialLine
)
{
this
.
specialLine
=
specialLine
;
this
.
specialLine
=
specialLine
;
}
}
public
String
getProxyport
()
{
return
proxyport
;
}
public
void
setProxyport
(
String
proxyport
)
{
this
.
proxyport
=
proxyport
;
}
public
String
getProxyprotocol
()
{
return
proxyprotocol
;
}
public
void
setProxyprotocol
(
String
proxyprotocol
)
{
this
.
proxyprotocol
=
proxyprotocol
;
}
}
}
src/main/java/com/edgec/browserbackend/browser/dto/IpResourceDto.java
View file @
a0405b6f
...
@@ -24,6 +24,13 @@ public class IpResourceDto {
...
@@ -24,6 +24,13 @@ public class IpResourceDto {
ShopDto
bindShop
;
ShopDto
bindShop
;
private
List
<
BindHistory
>
bindHistories
;
private
List
<
BindHistory
>
bindHistories
;
private
boolean
specialLine
;
//专线数据
private
String
proxyUsername
;
private
String
proxyPassword
;
private
String
proxyprotocol
;
private
String
proxyport
;
public
IpResourceDto
(){
public
IpResourceDto
(){
}
}
...
@@ -40,6 +47,11 @@ public class IpResourceDto {
...
@@ -40,6 +47,11 @@ public class IpResourceDto {
this
.
details
=
ipResource
.
getDetails
();
this
.
details
=
ipResource
.
getDetails
();
this
.
password
=
ipResource
.
getPassword
();
this
.
password
=
ipResource
.
getPassword
();
this
.
protocol
=
ipResource
.
getProtocol
();
this
.
protocol
=
ipResource
.
getProtocol
();
this
.
proxyUsername
=
ipResource
.
getProxyUsername
();
this
.
proxyPassword
=
ipResource
.
getProxyPassword
();
this
.
proxyport
=
ipResource
.
getProxyport
();
this
.
proxyprotocol
=
ipResource
.
getProxyprotocol
();
this
.
specialLine
=
ipResource
.
isSpecialLine
();
this
.
bindShop
=
shopDto
;
this
.
bindShop
=
shopDto
;
if
(
useHistory
)
if
(
useHistory
)
this
.
bindHistories
=
ipResource
.
getBindHistory
();
this
.
bindHistories
=
ipResource
.
getBindHistory
();
...
@@ -158,4 +170,44 @@ public class IpResourceDto {
...
@@ -158,4 +170,44 @@ public class IpResourceDto {
public
void
setBindHistories
(
List
<
BindHistory
>
bindHistories
)
{
public
void
setBindHistories
(
List
<
BindHistory
>
bindHistories
)
{
this
.
bindHistories
=
bindHistories
;
this
.
bindHistories
=
bindHistories
;
}
}
public
String
getProxyPassword
()
{
return
proxyPassword
;
}
public
void
setProxyPassword
(
String
proxyPassword
)
{
this
.
proxyPassword
=
proxyPassword
;
}
public
String
getProxyUsername
()
{
return
proxyUsername
;
}
public
void
setProxyUsername
(
String
proxyUsername
)
{
this
.
proxyUsername
=
proxyUsername
;
}
public
boolean
isSpecialLine
()
{
return
specialLine
;
}
public
void
setSpecialLine
(
boolean
specialLine
)
{
this
.
specialLine
=
specialLine
;
}
public
String
getProxyport
()
{
return
proxyport
;
}
public
void
setProxyport
(
String
proxyport
)
{
this
.
proxyport
=
proxyport
;
}
public
String
getProxyprotocol
()
{
return
proxyprotocol
;
}
public
void
setProxyprotocol
(
String
proxyprotocol
)
{
this
.
proxyprotocol
=
proxyprotocol
;
}
}
}
src/main/java/com/edgec/browserbackend/browser/task/Set3proxyTask.java
0 → 100644
View file @
a0405b6f
package
com
.
edgec
.
browserbackend
.
browser
.
task
;
import
com.edgec.browserbackend.account.repository.AccountRepository
;
import
com.edgec.browserbackend.auth.domain.mongo.MongoOAuth2AccessToken
;
import
com.edgec.browserbackend.auth.repository.mongo.MongoOAuth2AccessTokenRepository
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
java.io.FileInputStream
;
import
java.time.Instant
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Component
public
class
Set3proxyTask
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
Set3proxyTask
.
class
);
@Autowired
private
AccountRepository
accountRepository
;
@Autowired
private
MongoOAuth2AccessTokenRepository
mongoOAuth2AccessTokenRepository
;
// @Scheduled(cron = "0 0/1 * * * ?")
// public void set3proxy() {
// long validTime = Instant.now().minusSeconds(43200).toEpochMilli();
// List<String> tokenUsernames = mongoOAuth2AccessTokenRepository.findByCreatedAtGreaterThan(validTime).stream().map(MongoOAuth2AccessToken::getUsername).collect(Collectors.toList());
// List<String> accountParentDtos = accountRepository.findByNameIn(tokenUsernames).stream().map(x -> x.getParent() == null ? x.getName() : x.getParent()).distinct().collect(Collectors.toList());
//// FileInputStream fileInputStream = new FileInputStream();
// }
}
src/main/java/com/edgec/browserbackend/common/commons/utils/RemoteShellExecutor.java
View file @
a0405b6f
...
@@ -72,6 +72,7 @@ public class RemoteShellExecutor {
...
@@ -72,6 +72,7 @@ public class RemoteShellExecutor {
out
=
new
PrintWriter
(
new
OutputStreamWriter
(
session
.
getStdin
(),
out
=
new
PrintWriter
(
new
OutputStreamWriter
(
session
.
getStdin
(),
"UTF-8"
));
"UTF-8"
));
out
.
println
(
command
);
out
.
println
(
command
);
System
.
out
.
println
(
command
);
out
.
flush
();
out
.
flush
();
}
finally
{
}
finally
{
if
(
null
!=
out
)
{
if
(
null
!=
out
)
{
...
@@ -231,22 +232,59 @@ public class RemoteShellExecutor {
...
@@ -231,22 +232,59 @@ public class RemoteShellExecutor {
throw
new
RuntimeException
(
localFile
+
" is not a file"
);
throw
new
RuntimeException
(
localFile
+
" is not a file"
);
}
}
String
fileName
=
file
.
getName
();
String
fileName
=
file
.
getName
();
System
.
out
.
println
(
fileName
);
InputStream
stdOut
=
null
;
InputStream
stdErr
=
null
;
String
outStr
=
""
;
String
outErr
=
""
;
try
{
try
{
Session
session
=
conn
.
openSession
();
if
(
login
())
{
executeCommand
(
"mkdir -p "
+
remoteTargetDirectory
,
session
);
Session
session
=
conn
.
openSession
();
}
catch
(
Exception
e
)
{
session
.
startShell
();
throw
new
Exception
(
"登录远程机器失败"
+
ip
);
stdOut
=
new
StreamGobbler
(
session
.
getStdout
());
}
stdErr
=
new
StreamGobbler
(
session
.
getStderr
());
BufferedReader
stdoutReader
=
new
BufferedReader
(
new
InputStreamReader
(
stdOut
));
SCPClient
sCPClient
=
conn
.
createSCPClient
();
BufferedReader
stderrReader
=
new
BufferedReader
(
new
InputStreamReader
(
stdErr
));
SCPOutputStream
scpOutputStream
=
sCPClient
.
put
(
fileName
,
file
.
length
(),
remoteTargetDirectory
,
"0600"
);
executeCommand
(
"mkdir -p "
+
remoteTargetDirectory
,
session
);
SCPClient
sCPClient
=
conn
.
createSCPClient
();
SCPOutputStream
scpOutputStream
=
sCPClient
.
put
(
fileName
,
file
.
length
(),
remoteTargetDirectory
,
"0600"
);
String
content
=
IOUtils
.
toString
(
new
FileInputStream
(
file
),
StandardCharsets
.
UTF_8
);
String
content
=
IOUtils
.
toString
(
new
FileInputStream
(
file
),
StandardCharsets
.
UTF_8
);
scpOutputStream
.
write
(
content
.
getBytes
());
scpOutputStream
.
write
(
content
.
getBytes
());
scpOutputStream
.
flush
();
scpOutputStream
.
flush
();
scpOutputStream
.
close
();
scpOutputStream
.
close
();
session
.
waitForCondition
(
ChannelCondition
.
CLOSED
|
ChannelCondition
.
EOF
|
ChannelCondition
.
EXIT_STATUS
,
30000
);
logger
.
error
(
"Here is the output from stdout:"
);
while
(
true
)
{
String
line
=
stdoutReader
.
readLine
();
if
(
line
==
null
)
break
;
System
.
out
.
println
(
line
);
}
logger
.
error
(
"Here is the output from stderr:"
);
while
(
true
)
{
String
line
=
stderrReader
.
readLine
();
if
(
line
==
null
)
break
;
System
.
out
.
println
(
line
);
}
/* Show exit status, if available (otherwise "null") */
logger
.
error
(
"ExitCode: "
+
session
.
getExitStatus
());
session
.
close
();
/* Close this session */
conn
.
close
();
/* Close the connection */
}
}
catch
(
IOException
e
)
{
logger
.
error
(
e
.
getMessage
());
throw
new
Exception
(
"登录远程机器失败"
+
ip
);
}
finally
{
if
(
conn
!=
null
)
{
conn
.
close
();
}
IOUtils
.
closeQuietly
(
stdOut
);
IOUtils
.
closeQuietly
(
stdErr
);
}
}
}
...
@@ -281,8 +319,8 @@ public class RemoteShellExecutor {
...
@@ -281,8 +319,8 @@ public class RemoteShellExecutor {
}
}
public
static
void
main
(
String
args
[])
throws
Exception
{
public
static
void
main
(
String
args
[])
throws
Exception
{
RemoteShellExecutor
executor
=
new
RemoteShellExecutor
(
"
120.25.233.237"
,
"root"
,
"5t8EsTuDH00u
aA1"
);
RemoteShellExecutor
executor
=
new
RemoteShellExecutor
(
"
47.112.253.229"
,
"root"
,
"hIB4EbOcnkF5
aA1"
);
executor
.
transferFile
(
"3proxy.cfg"
,
"/root"
);
executor
.
transferFile
(
"3proxy.cfg"
,
"/root"
);
//
executor.execCommand("cd /root && sh restart.sh");
executor
.
execCommand
(
"cd /root && sh restart.sh"
);
}
}
}
}
\ No newline at end of file
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