{"id":917,"date":"2018-10-18T10:14:00","date_gmt":"2018-10-18T19:14:00","guid":{"rendered":"\/blog\/?p=917"},"modified":"2023-09-21T09:37:27","modified_gmt":"2023-09-21T00:37:27","slug":"fortify-sca-%eb%b6%84%ec%84%9d-%eb%b0%b0%ec%b9%98-%ec%88%9c%ec%b0%a8%ec%8b%a4%ed%96%89-%ec%8a%a4%ed%81%ac%eb%a6%bd%ed%8a%b8","status":"publish","type":"post","link":"https:\/\/hasu0707.duckdns.org\/blog\/?p=917","title":{"rendered":"[Fortify] SCA \ubd84\uc11d \ubc30\uce58 \uc21c\ucc28\uc2e4\ud589 \uc2a4\ud06c\ub9bd\ud2b8"},"content":{"rendered":"\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">:: ##################################################################\n:: #\n:: # MicroFocus Fortify SCA \ubd84\uc11d \ubc30\uce58 \uc21c\ucc28\uc2e4\ud589 \uc2a4\ud06c\ub9bd\ud2b8\n:: #\n:: # \uc774 \uc2a4\ud06c\ub9bd\ud2b8\ub294 PROJECT_BAT\uc5d0 \uc815\uc758\ub41c \ubc30\uce58\ud30c\uc77c\uc744 \uc21c\ucc28\uc801\uc73c\ub85c\n:: # \uc2e4\ud589\ud558\uba70 \ubaa8\ub4e0 \ubc30\uce58\ud30c\uc77c\uc758 \uc2e4\ud589\uc774 \uc644\ub8cc\ub420 \uacbd\uc6b0 \ub2e4\uc2dc \ucc98\uc74c\ubd80\ud130\n:: # \ubb34\ud55c \ub8e8\ud551\ud558\uc5ec \uc2e4\ud589\ud55c\ub2e4.\n:: #\n:: # \ub610\ud55c Sleeping time\uc744 \uc815\uc758\ud558\uc5ec \uc5c5\ubb34\uc2dc\uac04\uc5d0\ub294 \uad6c\ub3d9\uc774 \ub418\uc9c0\n:: # \uc54a\ub3c4\ub85d \uc124\uc815\ud560 \uc218 \uc788\ub2e4.\n:: #\n:: # \uc791\uc131\uc790: \uc774\uc874\uc11d (hasu0707@gmail.com)\n:: #\n:: ##################################################################\n@cls\n@echo off\n\n:: ##################################################################\n:: # Project ID\uc5d0 \ub300\uc751\ud558\ub294 \ubc30\uce58\ud30c\uc77c \ubc30\uc5f4 (\ubc30\uc5f4\uc758 \ucca8\uc790\ub85c \uad6c\ubd84\ud55c\ub2e4)\n:: ##################################################################\nset \"PROJECT_BAT[0]=D:\\desktop\\batch\\test1.bat\"\nset \"PROJECT_BAT[1]=D:\\desktop\\batch\\test2.bat\"\nset \"PROJECT_BAT[2]=D:\\desktop\\batch\\test3.bat\"\n\nsetlocal enableextensions enabledelayedexpansion\n:: ##################################################################\n:: #\n:: # \uae30\ubcf8 \ubcc0\uc218 \uc14b\ud305\n:: #\n:: # START_INDEX:       \uba87\ubc88 \ubc30\uce58\ubd80\ud130 \uc2e4\ud589\ud560 \uac83\uc778\uac00 ?\n:: # TIME_CHECK:        1\uc774\uba74 SLEEP\uc2dc\uac04 \uccb4\ud06c 0\uc774\uba74 \ubb34\uc870\uac74 \uc9c4\ud589\n:: # SLEEP_START_TIME:  SLEEP \uc2dc\uc791 \uc2dc\uac04 (00~23\uc2dc:00~59\ubd84:00~59\ucd08)\n:: # SLEEP_END_TIME:    SLEEP \ub9c8\uac10 \uc2dc\uac04 (00~23\uc2dc:00~59\ubd84:00~59\ucd08)\n:: # INTERVAL_SEC:      \ubc30\uce58 \ud558\ub098 \uc2e4\ud589 \ud6c4 \uc7a0\uc2dc \uc26c\ub294 \uc2dc\uac04 (\ucd08)\n:: # LOG_FILE:          \ub85c\uadf8 \ud30c\uc77c\n:: #\n:: ##################################################################\nset \/A  \"START_INDEX=0\"\nset \/A  \"TIME_CHECK=1\"\nset     \"SLEEP_START_TIME=09:00:00\"\nset     \"SLEEP_END_TIME=18:00:00\"\nset \/A  \"INTERVAL_SEC=30\"\nset     \"LOG_FILE=test.log\"\nset \/A  \"x=%START_INDEX%\"\n\n:: ##################################################################\n:: # \uc804\uccb4 \ubc30\uce58\ud30c\uc77c\uc758 \uac2f\uc218\ub97c \uc13c\ub2e4.\n:: ##################################################################\nset \/A \"i=0\"\n:Label_Index_Count\nif defined PROJECT_BAT[%i%] (\n  set \/A \"i+=1\"\n  goto :Label_Index_Count\n)\nset \/A INDEX_COUNT=%i%\n\n:: ##################################################################\n:: # \ubb34\ud55c\ub8e8\ud504 \uc2dc\uc791\n:: ##################################################################\n:Infinite_Loop\n    set \/A \"RUN_BATCH=1\"\n    if %x% geq %INDEX_COUNT% (\n        SET \/A \"x=0\"\n    )\n\n:: ##################################################################\n:: # \ud604\uc7ac \uc2dc\uac04\uc744 \uad6c\ud55c\ub2e4.\n:: ##################################################################\n    call :getTime TIME_NOW\n\n:: ##################################################################\n:: # \ud604\uc7ac \uc694\uc77c\uc744 1~7\uc758 \uc22b\uc790\ub85c \uad6c\ud55c\ub2e4.\n:: ##################################################################\n    for \/F \"skip=2 tokens=2-4 delims=,\" %%A in ('WMIC Path Win32_LocalTime Get DayOfWeek \/Format:csv') do set DAYNUMBER=%%A\n\n:: ##################################################################\n:: # \ubc30\uce58\ub97c \uc2e4\ud589 \ud560\uc9c0 \ub9d0\uc9c0 \uacb0\uc815\ud55c\ub2e4.\n:: ##################################################################\n    if %TIME_CHECK% == 1 (\n        if %DAYNUMBER% geq 6 (\n            goto Label_Main\n        )\n        if \"%TIME_NOW%\" geq \"%SLEEP_START_TIME%\" (\n            if \"%TIME_NOW%\" lss \"%SLEEP_END_TIME%\" (\n                set \/A \"RUN_BATCH=0\"\n                echo [%x%] Sleeping time: %SLEEP_START_TIME% ~ %SLEEP_END_TIME%\n            )\n        )\n    )\n\n:Label_Main\n    if %RUN_BATCH% == 1 (\n        echo.\n        echo #################################################\n        echo TIME_CHECK:%TIME_CHECK% \/ INDEX: %x%\n        echo Batch file: !PROJECT_BAT[%x%]!\n        echo Current Time: %TIME_NOW%,  Day of Week: %DAYNUMBER%\n        echo #################################################\n        call %%PROJECT_BAT[%x%]%%\n        echo %DATE% %TIME:~0,2%:%TIME:~3,2%:%TIME:~6,2% !PROJECT_BAT[%x%]! 1>> %LOG_FILE%\n    )\n:Label_Next\n    SET \/A \"x+=1\"\n\n:: ##################################################################\n:: # Run interval\n:: ##################################################################\n    ping 127.0.0.1 -n %INTERVAL_SEC% > nul\n\n:: ##################################################################\n:: # \ubb34\ud55c\ub8e8\ud504 \ub05d\n:: ##################################################################\ngoto :Infinite_Loop\n\nendlocal\nexit \/b\n\n:: ##################################################################\n:: #\n:: # getTime\n:: #\n:: # \uc774 \ud568\uc218\ub294 hh:mm:ss\uc758 24\uc2dc\uac04 \ud3ec\ub9f7\uc73c\ub85c \ud604\uc7ac \uc2dc\uac04\uc744 \ubc18\ud658\ud55c\ub2e4.\n:: # ex) call :getTime now : %now% \ubcc0\uc218\ub85c \ud604\uc7ac \uc2dc\uac04\uc774 \ubc18\ud658\ub41c\ub2e4.\n:: #\n:: ##################################################################\n:getTime returnVar [time]\n    setlocal enableextensions disabledelayedexpansion\n\n    :: Retrieve parameters if present. Else take current time\n    if \"%~2\"==\"\" ( set \"t=%time%\" ) else ( set \"t=%~2\" )\n\n    :: Test if time contains \"correct\" (usual) data. Else try something else\n    echo(%t%|findstr \/i \/r \/x \/c:\"[0-9:,.apm -]*\" >nul || (\n        set \"t=\"\n        for \/f \"tokens=2\" %%a in ('2^>nul robocopy \"|\" . \/njh') do (\n            if not defined t set \"t=%%a,00\"\n        )\n        rem If we do not have a valid time string, leave\n        if not defined t exit \/b\n    )\n\n    :: Check if 24h time adjust is needed\n    if not \"%t:pm=%\"==\"%t%\" (set \"p=12\" ) else (set \"p=0\")\n\n    :: Separate the elements of the time string\n    for \/f \"tokens=1-5 delims=:.,-PpAaMm \" %%a in (\"%t%\") do (\n        set \"h=%%a\" &amp; set \"m=00%%b\" &amp; set \"s=00%%c\" &amp; set \"c=00%%d\"\n    )\n\n    :: Adjust the hour part of the time string\n    set \/a \"h=100%h%+%p%\"\n\n    :: Clean up and return the new time string\n    :: endlocal &amp; if not \"%~1\"==\"\" set \"%~1=%h:~-2%:%m:~-2%:%s:~-2%,%c:~-2%\" &amp; exit \/b\n    endlocal &amp; if not \"%~1\"==\"\" set \"%~1=%h:~-2%:%m:~-2%:%s:~-2%\" &amp; exit \/b<\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[66],"tags":[],"class_list":["post-917","post","type-post","status-publish","format-standard","hentry","category-computing_fortify"],"_links":{"self":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/917","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=917"}],"version-history":[{"count":0,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/917\/revisions"}],"wp:attachment":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=917"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=917"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=917"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}