기본 베이스는 다른 블로그에서 퍼왔는데, 작동이 잘 되지 않거나, 불필요한 부분은 몽땅 날려버리고, 개인적으로 누락된 듯한 부분은 추가하고....  최초 저작자에게는 좀 미안한...
일부는 삭제하지 않고 콤마로 주석처리...

<?xml version="1.0" encoding="EUC-KR" ?>
<%
Response.ContentType = "text/xml"
Set xmlPars = Server.CreateObject("Msxml2.DOMDocument")

' 여기서 부터 rss 정보를 담는다.
Set rss = xmlPars.CreateElement("rss")
rss.setAttribute "version", "2.0"
rss.setAttribute "xmlns:dc", "http://purl.org/dc/elements/1.1/"
rss.setAttribute "xmlns:sy", "http://purl.org/rss/1.0/modules/syndication/"
rss.setAttribute "xmlns:admin", "http://webns.net/mvcb/"
rss.setAttribute "xmlns:rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlPars.AppendChild(rss)

'channel 시작
Set Channel = xmlPars.CreateElement("channel")
rss.AppendChild(Channel)

 'title정보
 Set title = xmlPars.CreateElement("title")
 Channel.AppendChild(title)
 Channel.childnodes(0).text = "대표 타이틀명"
 

이하 전부 주석처리


 'link정보
 'Set channel_link = xmlPars.CreateElement("link")
 'Channel.AppendChild(channel_link)
 'Channel.childnodes(1).text = "링크"

 'description정보
 'Set description = xmlPars.CreateElement("description")
 'Channel.AppendChild(description)
 'Channel.childnodes(2).text = "Good"

 'dc:language정보
 'Set language = xmlPars.CreateElement("dc:language")
 'Channel.AppendChild(language)
 'Channel.childnodes(3).text = "euc-kr"

 'image정보
 'Set image = xmlPars.CreateElement("image")
 'Channel.AppendChild(image)

 '이미지 정보에 들어갈 것들
 'set i_title = xmlPars.CreateElement("title")
 'set i_url = xmlPars.CreateElement("url")
 'set i_width = xmlPars.CreateElement("width")
 'set i_height = xmlPars.CreateElement("height")

 'image.AppendChild(i_title)
 'image.AppendChild(i_url)
 'image.AppendChild(i_width)
 'image.AppendChild(i_height)

 'image.childnodes(0).text = "이미지 제목"
 'image.childnodes(1).text = "이미지 경로"
 'image.childnodes(2).text = "이미지 가로 사이즈"
 'image.childnodes(3).text = "이미지 세로 사이즈"


 
 ' 여기서 부터는 포스트에 대해서 출력
 ' 우선 데이터를 읽어오자
%>
-------------------------------------------------------------
<OBJECT RUNAT="Server" PROGID="PegasusBOARD.clsBoard" ID="objProc"></OBJECT> '서버 오브젝트 방식일 경우.
-------------------------------------------------------------
<%
 objconn = "DB커넥션;" 'DB커넥션 방식일경우
 SQL = "SQL쿼리문"
 set rs = Server.CreateObject("ADODB.Recordset")
 rs.Open SQL,objconn,3


 ' 여기서 부터 루프를 돌리자.
 Do until rs.EOF
 strMsg = rs(7)

 Set item = xmlPars.CreateElement("item")
 Channel.AppendChild(item)
 
  ' 포스트 찌끄리기
  set title = xmlPars.CreateElement("title")
  set link = xmlPars.CreateElement("link")
  set description =  xmlPars.CreateElement("description")
  'set dcdate =  xmlPars.CreateElement("dc:date")
  'set dcsubject =  xmlPars.CreateElement("dc:subject")

  item.AppendChild(title)
  item.AppendChild(link)
  item.AppendChild(description)
  'item.AppendChild(dcdate)
  'item.AppendChild(dcsubject)

  item.childnodes(0).text = "타이틀 레코드값"
  item.childnodes(1).text = "링크+링크구분 레코드값"
  item.childnodes(2).text = "콘텐츠 레코드값"

 rs.movenext
 loop

Response.Write xmlPars.xml

rs.close
set rs = nothing
Set xmlPars = nothing
%>

ASP로 블로그를 만드는데 가장 핵심적인 부분이니, ASP 블로그도 한번 만들어 볼만 하겠네요.

저작자 표시 비영리 변경 금지
TAG asp, RSS
Posted by yol oktour 트랙백 0 : 댓글 0

ms-sql 컬럼내용 암호화

2009/01/27 13:07 from ASP

MS-SQL에서 내부적으로 지원하는 문서화되지 않은 문자열 함수인 PWDENCRYPT와 PWDCOMPARE를 통해 암호화 기능을 구현할수 있다.

<사용예제>

' 테이블을 생성한다, 암호화할 컬럼은 VARBINARY 타입으로 한다.

CREATE TABLE MEMBER
(
  UserId VARCHAR(25),
  UserPwd VARBINARY(100)
)

' 데이터를 입력한다. 암호화할 컬럼은 PWDENCRYPT메소드를 이용해서 넣는다.

INSERT INTO MEMBER (UserId, UserPwd)

VALUES ('ssey', PWDENCRYPT('seyoung')) 

' 해당아이디를 가진 회원의 암호화된 비밀번호 컬럼과 입력한 문자열 비밀번호를

' PWDCOMPARE(입력문자열, 컬럼명) 메소드를 이용해 비교한다.

' 둘이 같으면 1 (true), 틀리면 0 (false)를 리턴하게 된다.

' 그리고 원문이나 암호문 둘 중 하나가 NULL 이면 NULL을 리턴하게 된다.

SELECT PWDCOMPARE('SEYOUNG', UserPwd)

FROM MEMBER WHERE UserId='ssey'  ' 결과 : 1

결과를 살펴보면 대소문자는 구분하지 않음을 알 수 있다. 암호문의 경우 위에서 살펴본대로 대소문자를 분명 다르게 비교하였으나, PWDCOMPARE 함수에서는 대소문자를 무시하였다.

또한, 실행 결과를 보면 형태는 원문의 길이에 상관없이 30~35자 사이의 거의 일정한 길이의 암호문을 출력하는 것을 볼 수 있다.  테스트 결과 원문의 길이가 varchar 기준으로 128자를 넘었을 경우 에러를 발생 하였다.

Posted by yol oktour 트랙백 0 : 댓글 0

봇넷에 감염된 좀비 PC들의 공격이 예상외로 광범위합니다.

SQL-INJECTION 알아보기
봇넷 및 좀비에 대하여 알아보기(MS)

------------------------------------------------------------------------------------------------      
        Dim array_split_item
        Dim item
        Dim array_counter
        Dim item_position1
        Dim item_position2

  //아이피 차단 하기 (IP 기록 DB운영)
  if Request.ServerVariables("REMOTE_ADDR") = "차단" then
    Response.write "귀하의 IP는 차단되었습니다."
    Response.End
  End if

        array_split_item = Array("/*", "*/", "@@", "nchar", "varchar", "nvarchar", "alter", "begin", "cast", "create", "cursor", "declare", "delete", "drop", "exec","execute", "fetch", "kill", "sys", "sysobjects", "syscolumns","update", "truncate", "<script", "</script>", "='", "= '")

        for each item in Request.Form
                for array_counter = lbound(array_split_item) to ubound(array_split_item)
                        item_position1 = InStr(lcase(Request(item)), array_split_item(array_counter))
                        item_position2 = InStr(lcase(Request.Form), array_split_item(array_counter))

                        if (item_position1 > 0) or (item_position2 > 0) then
                                Response.Write("고만해~")
                                Response.End() 
                        end if
                next
        next

        for each item in Request.QueryString
                for array_counter = lbound(array_split_item) to ubound(array_split_item)
                        item_position1 = InStr(lcase(Request(item)), array_split_item(array_counter))
                        item_position2 = InStr(lcase(Request.QueryString), array_split_item(array_counter))
     
                        if (item_position1 > 0) or (item_position2 > 0) then
                                Response.Write("고만해~")
                                Response.End() 
                        end if
                next
        next
--------------------------------------------------------------------------------------------
무료로 제공되는 소프트웨어도 있지만, 기능상에서는 동일합니다.

처음 중국 IP들은 부담없이 차단했고, 아예 자동화해서 공격시도가 1회이상 반복되면 모두 자동차단
하도록 처리해서 수천개 이상의 IP가 차단 되었는데, 문제는 90%이상 한국 개인들과 회사 PC라는 겁니다.

유동 IP로 ISP에서 자동 할당되어 IP를 공유하여 사용하는 개인들을 차단할 경우, 엉뚱한 사람까지 당사
홈페이지 접속을 못하도록 하는 경우가 생길 수 있어 상당히 고민스럽더군요.

국내에서의 해킹시도는 중국에서 뿌린 악성코드에 감염된 개인과 회사의 PC들인데,대게 특정사이트를 방문했다가 하드디스크 캐쉬에 남아 발생하는 것입니다.

수시로, 웹페이지 캐쉬와 숨김속성으로 있는 캐쉬폴더인 C:\Documents and Settings\LocalService\Local Settings\Temp 폴더만 비워주셔도, 악성코드의 70~90%정도는 삭제됩니다.

예전에는 바이러스등을 시스템(window/system) 폴더에 복사를 했었는데, 요즘에는 Temp폴더에 많이 복사가 되는 편입니다. 오랫동안 temp폴더를 건드리지 않으셨던 분들은 설정하기에 따라 달라지지만, 이 캐쉬폴더의 용량만 수기가에 달하는 경우도 있을 겁니다. 

캐쉬폴더는 가상메모리 기능으로서, 프로그램을 사용하면서 큰 파일을 로드하거나 프로그램 인스톨시 임시로 압축을 풀어놓는 용도로 사용되는 폴더입니다.

프로그램을 닫으면 보통 같이 삭제되지만, 불완전 종료시에는 삭제되지 않고 그대로 캐쉬폴더에 남게됩니다.

중국이 뿌린 악성코드에 한국의 개인들과 회사의 서버간에 공격하고 차단하는 양상이 벌여졌습니다.
또한, 수만개의 국내 사이트들이 이 공격의 피해를 봤습니다.

사용자 삽입 이미지

위의 스크립트 주소로 구글등에서 검색하면, 합산 수만개의 사이트가 뜹니다.
대부분이 한국사이트들이구요. 이렇게 집계에 잡히지 않은 사이트까지 계산하면 그 규모는 더 커질겁니다.

그리고, 요즘은 바이러스를 찾아보기 어렵네요.
명성을 떨쳐보고자, 돈 안되는 바이러스 개발보다는 아무래도 분명한 금전적이 있는 쪽에 몰린다는 의미겠죠.
그래서, 바이러스와 달리, 감염되어도 특별한 증상이 없고, 백신도 거의 유명무실합니다.

그냥 열심히 보안패치하고, PC의 트래픽을 잘 관찰하는게 최선의 방법 같습니다.

Posted by yol oktour 트랙백 0 : 댓글 0

ASP
엑셀
<%
Response.Buffer = TRUE
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-disposition","attachment;filename=저장/오픈할 파일명.xls"
%>

워드
<%
 Response.Buffer = TRUE
 Response.ContentType = "application/msword"
 Response.AddHeader "Content-disposition","attachment;filename=저장/오픈할 파일명.doc"
%>

파워포인트
<%
 Response.Buffer = TRUE
 Response.ContentType = "application/powerpoint"
 Response.AddHeader "Content-disposition","attachment;filename=저장/오픈할 파일명.doc"
%>


html 태그 위에 카피 & 페이스트.

application/pdf
application/vnd.ms-excel
application/vnd.ms-powerpoint
application/word
application/x-mspowerpoint
application/x-msexcel


JSP
<%@ page contentType="application/vnd.ms-excel; name='My_Excel'" %>
<%
response.setHeader("Content-Disposition", "inline; filename=myfile.xls");
response.setHeader("Content-Description", "JSP Generated Data");
%>

PHP
<?
header(\"Content-Type: application/vnd.ms-excel\");
?>

Posted by yol oktour 트랙백 0 : 댓글 0