IPIgnore Interceptor 헤더 아이피 조작에 따른 아이피 패턴 검사 로직 추가
- 아이피 검사 실패(오류) 발생 혹은 아이피 범위가 아닌 경우 오류 발생 처리
This commit is contained in:
parent
1386835e5b
commit
bbc45b7a39
@ -85,6 +85,48 @@ public class IPIgnoreInterceptorHandler extends HandlerInterceptorAdapter{
|
|||||||
HackIpVO hackIpVO = new HackIpVO();
|
HackIpVO hackIpVO = new HackIpVO();
|
||||||
hackIpVO.setIgnoreIp(userIP);
|
hackIpVO.setIgnoreIp(userIP);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 헤더 아이피 체크 해주기
|
||||||
|
* "." 기준으로 문자열 분할 후 0 ~ 255 사이 값인지 체크
|
||||||
|
* 범위 값이 아닌경우 오류 처리
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
String[] checkIP = userIP.split("\\.");
|
||||||
|
boolean ipCheckType = false;
|
||||||
|
|
||||||
|
if(checkIP.length < 4 || checkIP == null) {
|
||||||
|
|
||||||
|
System.out.println("IPIgnoreInterceptorHandler-preHandle Header IP Check ERROR !!! ");
|
||||||
|
System.out.println("userIP ::: "+userIP);
|
||||||
|
response.sendRedirect(request.getContextPath() + "/");
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}else {
|
||||||
|
|
||||||
|
for(String tmp : checkIP) {
|
||||||
|
|
||||||
|
int ipNum = Integer.parseInt(tmp);
|
||||||
|
|
||||||
|
if(ipNum >=0 && ipNum <= 255) {
|
||||||
|
|
||||||
|
ipCheckType = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!ipCheckType) {
|
||||||
|
|
||||||
|
System.out.println("IPIgnoreInterceptorHandler-preHandle Header IP Check ERROR !!! ");
|
||||||
|
System.out.println("userIP ::: "+userIP);
|
||||||
|
response.sendRedirect(request.getContextPath() + "/");
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
int i_ignoreCnt = hackIpService.selectIgnoreIpCnt(hackIpVO);
|
int i_ignoreCnt = hackIpService.selectIgnoreIpCnt(hackIpVO);
|
||||||
|
|
||||||
//System.out.println("result=="+hackIpService.selectIgnoreIpCnt(hackIpVO));
|
//System.out.println("result=="+hackIpService.selectIgnoreIpCnt(hackIpVO));
|
||||||
@ -151,7 +193,11 @@ public class IPIgnoreInterceptorHandler extends HandlerInterceptorAdapter{
|
|||||||
loginLogService.logInsertLoginLog4Ajax(loginLog);
|
loginLogService.logInsertLoginLog4Ajax(loginLog);
|
||||||
|
|
||||||
}catch(Exception ex) {
|
}catch(Exception ex) {
|
||||||
ex.printStackTrace();
|
//ex.printStackTrace();
|
||||||
|
System.out.println("IPIgnoreInterceptorHandler-preHandle Error !!! " + ex);
|
||||||
|
//오류가 발생하면 메일화면으로 이동 시킨다.
|
||||||
|
response.sendRedirect(request.getContextPath() + "/");
|
||||||
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -163,11 +209,13 @@ public class IPIgnoreInterceptorHandler extends HandlerInterceptorAdapter{
|
|||||||
|
|
||||||
|
|
||||||
}catch(Exception ex) {
|
}catch(Exception ex) {
|
||||||
ex.printStackTrace();
|
//ex.printStackTrace();
|
||||||
|
System.out.println("IPIgnoreInterceptorHandler-preHandle Error !!! " + ex);
|
||||||
|
//오류가 발생하면 경로 오류를 발생 시킨다.
|
||||||
|
response.sendRedirect(request.getContextPath() + "/");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return v_ret;
|
return v_ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user