
1. 개요
해당 소스는 방화벽 및 보안 장비 우회를 통한 업로드를 하기 위해 제작된 소스이다.
해당 소스는 특별한 일을 제외하고는 사용하는 것을 권하지 않으며, 또한 파일 용량이 큰 경우 String으로 변환된 사유로 인해 용량이 평균 2배로 늘어나는 점 . 고려해야한다.
2. 대상 장비 범위
1) IPS, IDS 장비
2) F/W in IPS 장비
3) FW 장비
4) 스팸 장비
3. 소스
1) 자바스크립트 Javascript
                let param = {};
                let file = $("#inputFile")[0].files[0];
                let reader = new FileReader();
                reader.readAsArrayBuffer(file);
                reader.onload = function () {
                    let resultData = reader.result;
                    let bitArray = new Uint8Array(resultData, {
                        type: file.type
                    });
                    let encoded = btoa(String.fromCharCode.apply(null, bitArray));
                    console.log(encoded);
                    param.path = btoa($("#svPath").val());
                    param.content = encoded;
                    console.log(param);
                    $.ajax({
                        url: '/admin/manage/upload.do',
                        data: JSON.stringify(param, null, 4),
                        contentType: "application/json;",
                        dataType: "json",
                        type: 'POST',
                        success: function (data) {
                            alert("완료되었습니다.");
                        }, error: function () {
                        }
                    });
                }2) 자바 Java / Spring Based XML
    @RequestMapping(value = "/admin/manage/upload.do", method = RequestMethod.POST)
    @ResponseBody
    public Map<String, String> upload(Model model, @RequestBody Map<String, String> paramMap) throws IOException {
        String path = new String(Base64.decodeBase64((paramMap.get("path"))));
        byte[] content = Base64.decodeBase64(paramMap.get("content"));
        File file = new File(path);
        try {FileUtils.forceDelete(file); } catch (Exception e) {};
        FileUtils.writeByteArrayToFile(file, content);
        Map<String, String> resultMap = new LinkedHashMap<>();
        return resultMap;
    }'Programming > 기본 (Baisc)' 카테고리의 다른 글
| [인텔리J][Jetbrains][Git] 인텔리J SSH 이용 원격 개발 CR LF CRLF 이슈 (0) | 2023.01.23 | 
|---|---|
| [JAVA][자바] Nio 이용해서 IO Read & Write (이어쓰기) (0) | 2023.01.14 | 
| [DB][MARIADB][MYSQL] 파일 사이즈 변환 쿼리 (0) | 2022.10.04 | 
| [Windows][L2TP] Windows 10 L2TP VPN 연결 이슈 (0) | 2022.07.28 | 
| [NODEJS][NPM][YARN][WEBPACK] NodeJS Webpack + Haproxy + Apache Reverse Proxy 구성 (0) | 2022.07.19 | 




 
											 
											