Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
slack-progress-bar-kjh
Advanced tools
진행상황을 시각화하여 슬랙으로 보여주는 파이썬 라이브러리 (파이썬 3.9이상)
pip install slack-progress-bar-kjh
chat:write
, channels:manage
, groups:write
, im:write
, mpim:write
.SlackProgressBarKjh
클래스의 token
필드에 사용하세요.SlackProgressBarKjh
클래스의 user_id
필드에 사용하세요. (필요에 따라 채널ID도 사용 가능)token
과 user_id
또는 채널 ID를 사용하여 진행 표시줄을 생성하고 업데이트하세요.import os
from slack_progress_bar_kjh import SlackProgressBarKjh
BOT_TOKEN = os.getenv('BOT_TOKEN')
os.getenv('SLACK_MEMBER_ID')
# 작업 시작
progress_bar = SlackProgressBarKjh(token=self.BOT_TOKEN, user_id=self.SLACK_MEMBER_ID, total=100)
for i in range(100):
try:
# 작업 중...
time.sleep(0.1)
# 진행 상황 업데이트
progress_bar.update(i+1)
# 현재 상황 알려주기
progress_bar.chat_update(f"{i}번 작업 완료")
# 현재 진행률 가져오기
progress_bar.get_progress()
except Exception:
progress_bar.error()
# Dockerfile
# Dockerfile
FROM python:3.9-slim
# Set working directory
WORKDIR /app
# Copy necessary files
COPY Jenkins/progress_tracker.py /app/
# Install dependencies
RUN pip install slack-progress-bar-kjh flask
# Expose port if needed
EXPOSE 5000
# Command to run the script
CMD ["python", "progress_tracker.py"]
# progress_tracker.py
import os
from flask import Flask, request
from slack_progress_bar_kjh import SlackProgressBarKjh
app = Flask(__name__)
BOT_TOKEN = os.getenv('BOT_TOKEN')
SLACK_MEMBER_ID = os.getenv('SLACK_MEMBER_ID')
progress_bar = SlackProgressBarKjh(token=BOT_TOKEN, user_id=SLACK_MEMBER_ID, total=100)
progress_state = {'progress': 0}
@app.route('/update-all', methods=['POST'])
def update_all():
data = request.json
progress = data.get('progress')
message = data.get('message')
update_progress(progress, message)
return "Progress all updated", 200
@app.route('/update-progress', methods=['POST'])
def update_progress_route():
data = request.json
progress = data.get('progress')
update_progress(progress=progress)
return "Only progress updated", 200
@app.route('/update-message', methods=['POST'])
def update_message():
data = request.json
message = data.get('message')
update_progress(message=message)
return "Only message updated", 200
@app.route('/add-progress', methods=['POST'])
def add_progress():
data = request.json
progress = data.get('progress')
add_progress_to_state(progress)
return "Add progress updated", 200
@app.route('/get-progress', methods=['GET'])
def get_progress():
return progress_state['progress']
def update_progress(progress=None, message=None):
if progress is not None:
progress_state['progress'] = progress
progress_bar.update(progress)
if message is not None:
progress_bar.chat_update(message)
def add_progress_to_state(progress=0):
progress_bar.add_progress(progress)
progress_state['progress'] = progress_bar.get_progress()
if __name__ == "__main__":
app.run(host='0.0.0.0', port=5000)
// Jenkinsfile
pipeline {
agent any
environment {
BOT_TOKEN = credentials('SLACK_BOT_TOKEN') // Slack Bot Token
SLACK_MEMBER_ID = credentials('SLACK_MEMBER_ID') // Slack ID
TRACKER_IMAGE = 'progress-tracker:latest' // 빌드할 Docker 젠킨스 트래커 이미지 이름
}
stages {
stage('Jenkins Tracker - Build Docker Image') {
steps {
script {
// 젠킨스 진행 상황 추적 컨테이너 이미지 빌드
sh '''
sudo yum install -y python3 python3-pip
docker build -t ${TRACKER_IMAGE} -f Jenkins/Dockerfile .
'''
}
}
}
stage('Jenkins Tracker - Start Tracker') {
steps {
script {
// 젠킨스 진행 상황 추적 컨테이너 시작
sh '''
sudo docker run -d --name progress_tracker \
-e BOT_TOKEN=${BOT_TOKEN} \
-e SLACK_MEMBER_ID=${SLACK_MEMBER_ID} \
-p 5000:5000 ${TRACKER_IMAGE}
sleep 5
'''
}
}
}
stage('Build') {
steps {
script {
// 초기화 단계 진행률 업데이트
sh '''
curl -X POST -H "Content-Type: application/json" \
-d '{"progress": 10, "message": "슬랙과"}' \
http://localhost:5000/update
'''
// 진행률 업데이트
sh '''
curl -X POST -H "Content-Type: application/json" \
-d '{"progress": 20, "message": "젠킨스"}' \
http://localhost:5000/update
'''
// 진행률 업데이트
sh '''
curl -X POST -H "Content-Type: application/json" \
-d '{"progress": 30, "message": "연동을"}' \
http://localhost:5000/update
'''
// 진행률 업데이트
sh '''
curl -X POST -H "Content-Type: application/json" \
-d '{"progress": 40, "message": "테스트하고"}' \
http://localhost:5000/update
'''
// 진행률 업데이트
sh '''
curl -X POST -H "Content-Type: application/json" \
-d '{"progress": 50, "message": "있는"}' \
http://localhost:5000/update
'''
// 진행률 업데이트
sh '''
curl -X POST -H "Content-Type: application/json" \
-d '{"progress": 60, "message": "중 입니다."}' \
http://localhost:5000/update
'''
// 진행률 업데이트
sh '''
curl -X POST -H "Content-Type: application/json" \
-d '{"progress": 70, "message": "잘"}' \
http://localhost:5000/update
'''
// 진행률 업데이트
sh '''
curl -X POST -H "Content-Type: application/json" \
-d '{"progress": 80, "message": "되는 것"}' \
http://localhost:5000/update
'''
// 진행률 업데이트
sh '''
curl -X POST -H "Content-Type: application/json" \
-d '{"progress": 90, "message": "같아요."}' \
http://localhost:5000/update
'''
}
}
}
stage('Complete and Cleanup') {
steps {
script {
// Build 성공 후 최종 진행률 업데이트
sh '''
curl -X POST -H "Content-Type: application/json" \
-d '{"progress": 100, "message": "테스트 끝!!!"}' \
http://localhost:5000/update
'''
}
}
post {
always {
// Docker 컨테이너 종료 및 정리
sh '''
docker stop progress_tracker
docker rm progress_tracker
'''
}
}
}
}
}
# docker-compose.yml
# Dockerfile.tracker
# Dockerfile.monitor
# monitor.py
FAQs
Modify from Michael Lizzi's slack_progress_bar. Thank you.
We found that slack-progress-bar-kjh demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.