[WHY]어느날 갑자기 알송의 "씽크 가사" 기능이 괜찮다는 생각이 들었고, 동일한 노래라도 많은 변형파일이
있을 진데 어떻게 저렇게 찾아올까? 라는 생각이 들었습니다. MP3파일에도 해당 파일의 정보들을 기록하는
영역이 있다라고 들었는데 그 부분도 확인할 겸 가볍게 접근했습니다.
[확인 과제] 알송은 어떻게 온라인에서 해당 MP3파일의 가사를 정확히 가져오는가?
[확인 과정]
1. MP3의 구조 확인
[그림]MP3파일의 개괄적인 구조

[TAG v2] Frame1 Frame2 Frame3... [TAG v1]
TAG는 크게 보면 버전이 두가지가 있으며 v1은 1.0과 v1.1두가지가 있습니다.
[그림]ID3 Tag v1.0 / v.1.1 / v2.0 *순서대로
<출처>naver blog ttakiya님(http://blog.naver.com/ttakiya?Redirect=Log&logNo=120001348951)



http://www.multiweb.cz/twoinches/MP3inside.htm#TAG1
2. 알송프로그램에서 온라인 가서 서버로 어떻게 요청되는지를 확인해보자.
a. ethereal로 capture한 결과... 허걱? 전달하는 값이 message digest로 되어 있네...
[참조code]알송이 온라인 서버에 가사요청하는 packet내용
------------------------------------------------------
POST /alsongwebservice/service1.asmx HTTP/1.1
Host: lyrics.alsong.co.kr
User-Agent: gSOAP/2.7
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 699
Connection: close
SOAPAction: "ALSongWebServer/GetLyric5"
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns2="ALSongWebServer/Service1Soap" xmlns:ns1="ALSongWebServer" xmlns:ns3="ALSongWebServer/Service1Soap12">
<SOAP-ENV:Body>
<ns1:GetLyric5>
<ns1:stQuery>
<ns1:strChecksum>45c0c42832c579505401c31d0984e551</ns1:strChecksum>
<ns1:strVersion>1.93</ns1:strVersion>
<ns1:strMACAddress>00ff667f9a08</ns1:strMACAddress>
<ns1:strIPAddress>xxx.xxx.xxx.xxx</ns1:strIPAddress>
</ns1:stQuery>
</ns1:GetLyric5>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
------------------------------------------------------
[참조code]온라인 서버에서 응답한 내용 packet내용
*한글이 UTF-8포멧으로 전달되어 깨져버렸기에 그냥 임의의 값을 넣음.
------------------------------------------------------
HTTP/1.1 200 OK
Connection: close
Date: Tue, 11 Mar 2008 10:58:58 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private, max-age=0
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 2782
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetLyric5Response xmlns="ALSongWebServer">
<GetLyric5Result>
<strStatusID>1</strStatusID>
<strInfoID>2194425</strInfoID>
<strRegistDate>2007-04-06 21:10:07.000</strRegistDate>
<strTitle>우리들의 겨울</strTitle>
<strArtist>자전거탄풍경</strArtist>
<strAlbum>Made In JTP 2nd Project Album</strAlbum>
<strCountGood>0</strCountGood>
<strCountBad>0</strCountBad>
<strLyric>......가사......</strLyric>
<strRegisterFirstName>첫번째등록자명</strRegisterFirstName>
<strRegisterFirstEMail />
<strRegisterFirstURL>www.altools.co.kr</strRegisterFirstURL>
<strRegisterFirstPhone />
<strRegisterFirstComment />
<strRegisterName>123</strRegisterName>
<strRegisterEMail />
<strRegisterURL />
<strRegisterPhone />
<strRegisterComment />
</GetLyric5Result>
</GetLyric5Response>
</soap:Body>
</soap:Envelope>
------------------------------------------------------
아, 그럼 저게 뭔지 확인을 하려면... ID3값을 바꿔보면서 언제 틀려지는지 확인하자.
뭐 보나마나 제목이겠지. 그것 틀리면 가사 못읽어 올테고...그런데 이런저런 ID3의 값을
다 바꿔봐도 가사는 계속 제대로 읽어오는 것이었다. 물론 md값도 바뀌지 않고...
음, 오기가 생긱기 시작했다. 도대체 뭐를 가지고 md값을 만든거야?
3. MP3구조설명을 토대로 실제 가지고 있는 MP3파일을 분석하다.
*대상 곡은 여행스케치의 우리들의 겨울입니다.
[그림]ultraedit를 통하여 파일 오픈하여 첫번째 frame header값(16진수) 확인

[그림]계산기를 이용한 16진수<->이진수변환

위치 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 |
값 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
이것을 보고 "우리들의 겨울"이라는 MP3파일이 가진 속성을 기술하면
-MPEG Version 1
-error protection : No
-Bit Rate : 192
-Frequency : 44100
-Mode : stereo
-Copyright : No
-Original : Yes
역시나 ID3 Tag값 외, audio data가 있는 frame에는 해당 곡을 구분할 수 있는 data가 없다라는 결론이 나왔습니다.
그럼 어떻게?
4. 일단 audio frame의 값을 임의로 바꿔보자!
첫번째 frame의 값을 한 byte라도 바꾸고 나니 전혀 다른 곡으로 인식을 했습니다. 두번째 이후의 frame은 바꾸어도
문제가 없었구요. 아! 이제 알겠다. 알송은 첫번째 audio frame전체의 md값을 생성하여 해당 곡을 unique 구분하는구나...
[참조code]첫번재 frame의 1byte를 변경후 요청한 결과(자료를 찾지 못함)
------------------------------------------------------
HTTP/1.1 200 OK
Connection: close
Date: Fri, 14 Mar 2008 04:05:28 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private, max-age=0
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 742
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetLyric5Response xmlns="ALSongWebServer">
<GetLyric5Result>
<strStatusID>2</strStatusID>
<strInfoID>-1</strInfoID>
<strRegistDate />
<strTitle />
<strArtist />
<strAlbum />
<strCountGood>0</strCountGood>
<strCountBad>0</strCountBad>
<strLyric />
<strRegisterFirstName />
<strRegisterFirstEMail />
<strRegisterFirstURL />
<strRegisterFirstPhone />
<strRegisterFirstComment />
<strRegisterName />
<strRegisterEMail />
<strRegisterURL />
<strRegisterPhone />
<strRegisterComment />
</GetLyric5Result>
</GetLyric5Response>
</soap:Body>
</soap:Envelope>
------------------------------------------------------
결과적으로 보니 알송 개발자들이 왜 이런 방식을 썼는지 이해가 되었습니다.
수학문제를 풀 때, "...가 참인지 증명하라"라는 문제를 풀듯이 논리적으로 풀지는 못했습니다만 ㅠ.ㅠ
나름 신나는 quiz를 풀었던것 같습니다.
덧글
감사합니다.
^^&
많은 도움이 되었어요~~^^
항상 스쳐지나가던 궁금증이 해결되었습니다.
URL 명시하여 담아가도록 하겠습니다^^
패킷까지 뽑은채로 이 문서를 봐버렸습니다. ㅡㅡ;;;
꼭 문제 열심히 풀다가 답안지가 옆에 펼쳐져 있는 것을 봐버린 기분이군요.
그래도 자료 감사합니다.
여행스케치 노래 전곡 다 아는데,
우리들의 겨울..이라는 처음 듣는 노래 제목이 나와서요.
다시 보니 자전거탄 풍경의 노래인가 보네요. ㅎ.
좋은 자료 넘 감사합니다.