2024年网络安全最新一起用python做个炫酷音乐播放器,想听啥随便搜!【V2(3),被腾讯辞退的高级网络安全工程师现在怎么了

本人从事网路安全工作12年,曾在2个大厂工作过,安全服务、售后服务、售前、攻防比赛、安全讲师、销售经理等职位都做过,对这个行业了解比较全面。

最近遍览了各种网络安全类的文章,内容参差不齐,其中不伐有大佬倾力教学,也有各种不良机构浑水摸鱼,在收到几条私信,发现大家对一套完整的系统的网络安全从学习路线到学习资料,甚至是工具有着不小的需求。

最后,我将这部分内容融会贯通成了一套282G的网络安全资料包,所有类目条理清晰,知识点层层递进,需要的小伙伴可以点击下方小卡片领取哦!下面就开始进入正题,如何从一个萌新一步一步进入网络安全行业。

学习路线图

其中最为瞩目也是最为基础的就是网络安全学习路线图,这里我给大家分享一份打磨了3个月,已经更新到4.0版本的网络安全学习路线图。

相比起繁琐的文字,还是生动的视频教程更加适合零基础的同学们学习,这里也是整理了一份与上述学习路线一一对应的网络安全视频教程。

网络安全工具箱

当然,当你入门之后,仅仅是视频教程已经不能满足你的需求了,你肯定需要学习各种工具的使用以及大量的实战项目,这里也分享一份我自己整理的网络安全入门工具以及使用教程和实战。

项目实战

最后就是项目实战,这里带来的是SRC资料&HW资料,毕竟实战是检验真理的唯一标准嘛~

面试题

归根结底,我们的最终目的都是为了就业,所以这份结合了多位朋友的亲身经验打磨的面试题合集你绝对不能错过!

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化资料的朋友,可以点击这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

2. 音乐本地下载及添加我喜爱的歌曲

我们根据V1.0版本完成的,输入的关键字和选择音乐来源进行音乐爬取,通过多线程,将歌曲、歌手、歌曲url地址全都获取;并将这些爬取的音乐数据列表显示到搜索页面中。双击列表页面中某一首歌曲,即可实现音乐播放功能。

V2.0版本中,我们添加了对当前播放音乐的本地下载、搜索页音乐列表一键下载、喜爱的歌列表一键下载、添加我喜爱的歌曲功能。

音乐下载:

对于音乐下载,我们可以进行当前播放音乐下载、搜索页音乐列表一键下载、喜爱的歌一键下载。如下图所示:在这里插入图片描述
核心代码如下:

# 当前播放音乐下载
def down(self):
    if bo == 'local':
        downpath = str(filew)
        downpath = downpath.replace('/', '\\')
        downpath = downpath + SongName[num]
        print(downpath)
        print('explorer /select,{}'.format(downpath))
        call('explorer /select,{}'.format(downpath))
    else:
        call('explorer /select,{}'.format(to))

# 下载所有音乐
def downloadall(self, typer):
     try:
         global typerr
         typerr = typer
         print(typer)
         print(typerr)
         self.work = downall()
         self.work.start()
         self.work.trigger.connect(self.disdownall)
     except:
         print('默认图片下载错误')
         pass

# 下载搜索页列表所有音乐
def downloadalls(self):
    self.downloadall('boing')
# 下载喜爱的歌列表所有音乐
def downloadalllove(self):
    self.downloadall('love')

添加喜爱的歌:

对于添加喜爱的歌曲,我们可以通过当前播放音乐的❤标志,也可以通过右键音乐列表进行喜爱的歌曲添加。核心代码如下:

# 通过点击❤标志,对当前播放音乐添加喜爱的歌
def lovesong(self):
    if bo == 'boing' or bo == 'boed':
        try:
            global loves
            global loveurls
            global lovepics
            global lovelrc
            if bo == 'boing':
                loves.append(songs[num])
                loveurls.append(urls[num])
                lovepics.append(pic[num])
                lovelrc.append(lrcs[num])
            elif bo == 'boed':
                loves.append(songed[num])
                loveurls.append(urled[num])
                lovepics.append(picd[num])
                lovelrc.append(lrcd[num])
            else:
                pass
        except:
            pass
        self.work = firstThread()
        self.work.start()
        self.work.trigger.connect(self.dispng)
        r = 0
        self.listwidget3.clear()
        for i in loves:
            self.listwidget3.addItem(i)
            self.listwidget3.item(r).setForeground(Qt.white)
            r = r + 1
        print(loves)
    else:
        pass

# 通过右键音乐列表进行喜爱的歌曲添加
def addItem(self):
    try:
        global loves
        global loveurls
        global lovepics
        global lovelrc
        if list_confident == 'boing':
            loves.append(songs[num_m])
            loveurls.append(urls[num_m])
            lovepics.append(pic[num_m])
            lovelrc.append(lrcs[num_m])
        else:
            loves.append(songed[num_m])
            loveurls.append(urled[num_m])
            lovepics.append(picd[num_m])
            lovelrc.append(lrcd[num_m])
        self.work = firstThread()
        self.work.start()
        self.work.trigger.connect(self.dispng)
    except:
        pass
    r = 0
    self.listwidget3.clear()
    for i in loves:
        self.listwidget3.addItem(i)
        self.listwidget3.item(r).setForeground(Qt.white)
        r = r + 1
    print('done')
    print(loves)

这样我们就可以把歌曲添加到喜爱的歌子列表页面下,如下图所示。
在这里插入图片描述

3. 喜爱的歌初始化读取显示及列表播放

对于添加到喜爱的歌曲列表,我们需要在退出音乐播放器程序时,将这些数据保存到本地文件,方便后面重新运行时初始化读取显示列表。

喜爱歌曲本地保存:
我们可以把喜爱的歌曲列表、喜爱歌曲图片、歌曲url链接、歌词等数据保存到本地。核心代码如下:

def close(self):
    reply = QMessageBox.question(self, u'警告', u'确定退出?', QMessageBox.Yes,
                                 QMessageBox.No)
    if reply == QMessageBox.Yes:
        close = True
        try:
            mixer.music.stop()
        except:
            pass
        try:
            rmtree(str(data))
        except Exception as e:
            print('删除错误类型是', e.__class__.__name__)
            print('删除错误明细是', e)
        filepath = '{}/musicdata'.format(apdata)
        try:
            mkdir(filepath)
        except:
            pass
        print(filepath)
        with open(filepath + "/loves", 'w', encoding='utf-8') as f:
            f.truncate(0)
            print(f.write(str(loves)))
        with open(filepath + "/lovepics", 'w', encoding='utf-8') as f:
            f.truncate(0)
            print(f.write(str(lovepics)))
        with open(filepath + "/loveurls", 'w', encoding='utf-8') as f:
            f.truncate(0)
            print(f.write(str(loveurls)))
        with open(filepath + "/lovelrc", 'w', encoding='utf-8') as f:
            f.truncate(0)
            print(f.write(str(lovelrc)))
        with open(filepath + "/voice", 'w', encoding='utf-8') as f:
            f.truncate(0)
            print(f.write(str(voice)))
        try:
            rmtree(str(data))
        except Exception as e:
            print('删除错误类型是', e.__class__.__name__)
            print('删除错误明细是', e)
        exit()
    else:
        pass

喜爱的歌初始化读取:
重新运行音乐播放器时,我们需要加载保存在本地的喜爱歌曲数据,并将歌曲列表信息加载显示到喜爱的歌子列表页面中。核心代码如下:

def run(self):
    try:
        apdataas = getenv("APPDATA")
        filepathas = '{}/musicdata'.format(apdataas)
        global lovelrc
        global loveurls
        global loves
        global lovepics
        global voice
        # 读取历史数据开始
        try:
            with open(filepathas + "/voice", 'r', encoding='utf-8') as f:
                a = f.read()
                # print(a)
                voice = float(a)
            print(voice)
            self.trigger.emit(str('voicedone'))
        except:
            self.trigger.emit(str('voicedone'))
            pass
        with open(filepathas + "/loves", 'r', encoding='utf-8') as f:
            a = f.read()
            print(a)
        strer = a
        loves = literal_eval(strer)
        with open(filepathas + "/lovepics", 'r', encoding='utf-8') as f:
            a = f.read()
            print(a)
        strer = a
        lovepics = literal_eval(strer)
        with open(filepathas + "/loveurls", 'r', encoding='utf-8') as f:
            a = f.read()
            print(a)
        strer = a
        loveurls = literal_eval(strer)
        with open(filepathas + "/lovelrc", 'r', encoding='utf-8') as f:
            a = f.read()
            print(a)
        strer = a
        lovelrc = literal_eval(strer)
        self.trigger.emit(str('login'))
        print(loves)
        print('read finish')
    except:
        print('read error')
        pass
    # 读取数据结束

    # 下载喜爱的歌列表中首项的歌曲封面
    try:
        req = get(lovepics[0])
        checkfile = open(str(data + '/ls3.png'), 'w+b')
        for i in req.iter_content(100000):
            checkfile.write(i)

        checkfile.close()
        lsfile = str(data + '/ls3.png')
        safile = str(data + '/first.png')
        draw(lsfile, safile)
        self.trigger.emit(str('first'))
    except:
        self.trigger.emit(str('nofirst'))
        pass    

列表播放:
对于加载的喜爱歌曲列表,我们可以对歌曲进行列表一键播放。

# 音乐播放
def bofang(self, num, bo):
    print('尝试进行播放')
    try:
        import urllib
        global pause
        global songs
        global music
        global downloading
        downloading = True
        self.console_button_3.setIcon(icon('fa.pause', color='#F76677', font=18))
        pause = False
        try:
            mixer.stop()
        except:
            pass
        mixer.init()
        try:
            self.Timer = QTimer()
            self.Timer.start(500)
        except:
            pass
        try:
            self.label.setText('正在寻找文件...')
            self.work = WorkThread()
            self.work.start()
            self.work.trigger.connect(self.display)
        except:
            print('无法播放,歌曲下载错误')
            downloading = False
            pass
    except:
        sleep(0.1)
        print('播放系统错误')
        pass

# 播放所有歌曲 
def playall(self, typer):
    global num
    global bo
    try:
        bo = typer
        num = 0
        self.bofang(bo, num)
    except:
        print('playall error')
        pass 
# 播放喜爱歌曲
def allplaylove(self):
    self.playall('love')

4. 歌词显示

对于播放的歌曲,我们可以进行歌词打印显示。核心代码如下:

def run(self):
	if bo == 'love': 
        try:
            proxies = {
                'http': 'http://124.72.109.183:8118',
                'http': 'http://49.85.1.79:31666'

            }
            headers = {
                'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36',
                'X-Requested-With': 'XMLHttpRequest'}
            try:
                try:
                    try:
                        aq = lovepics[num]
                        aqq = aq.split('/')
                    except:
                        pass
                    if type == 'kugou' and len(aqq) - 1 == 6:
                        aqqe = str(aqq[0]) + str('//') + str(aqq[2]) + str('/') + str(aqq[3]) + str('/') + str(
                            '400') + str('/') + str(aqq[5]) + str('/') + str(aqq[6])
                        print(aqqe)
                    elif type == 'netease' and len(aqq) - 1 == 4:
                        aqn = aq.split('?')
                        b = '?param=500x500'
                        aqqe = (str(aqn[0]) + str(b))
                        print(aqqe)
                    else:
                        aqqe = lovepics[num]
                    req = get(aqqe)

                    checkfile = open(str(data + '/ls1.png'), 'w+b')
                    for i in req.iter_content(100000):
                        checkfile.write(i)

                    checkfile.close()
                    lsfile = str(data + '/ls1.png')
                    safile = str(data + '/back.png')
                    draw(lsfile, safile)
                    picno = True
                except:
                    print('图片错误')
                    picno = False
                    pass

                url1 = loveurls[num]
                print(url1)
                # os.makedirs('music', exist\_ok=True)
                number = number + 1
                path = str(data + '\{}.临时文件'.format(number))
                headers = {
                    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.110.430.128 Safari/537.36',
                    'X-Requested-With': 'XMLHttpRequest'
                }
                with get(url1, stream=True, headers=headers) as r, open(path, 'wb') as file:
                    total_size = int(r.headers['content-length'])
                    content_size = 0
                    for content in r.iter_content(chunk_size=1024):
                        if not stopdown:
                            file.write(content)
                            content_size += len(content)
                            plan = (content_size / total_size) \* 100
                            # print(int(plan))
                            develop = str(int(plan)) + str('%')
                            self.trigger.emit(str(develop))
                        else:
                            print ('down')
                            break
                        stopdown = False
                to = 'downloadmusic\{}.mp3'.format(songed[num])
                makedirs('downloadmusic', exist_ok=True)
            except:
                self.trigger.emit(str('nofinish'))
                pass
            try:
                lrct = []
                f = lovelrc[num]  # 按行读取
                # print(f)
                lines = f.split('\n')
                # print(lines)
                for i in lines:
                    line1 = i.split('[')
                    try:
                        line2 = line1[1].split(']')
                        if line2 == '':
                            pass
                        else:
                            linew = line2[1]
                            # print(linew)
                            lrct.append(linew)
                        self.trigger.emit(str('lrcfinish'))
                    except:
                        print('歌词错误')
            except:
                pass
            try:
                copyfile(path, to)
            except:
                pass
            downloading = False
            self.trigger.emit(str('finish'))
        except:
            self.trigger.emit(str('nofinish'))  

效果如下所示:
在这里插入图片描述

5. 本地歌曲读取播放

首先我们可以对本地文件夹目录下的音乐进行读取添加到本地歌曲列表中,根据歌曲的文件名进行列表显示。核心代码如下:

# 本地歌曲文件夹读取添加
def add(self):
    try:
        global SongPath
        global SongName
        global num
        global filew
        global asas
        fileN = QFileDialog.getExistingDirectory(None, "选取文件夹", "")
        if not fileN == '':
            self.listwidget5.clear()
            filew = fileN + '/'
            asas = filew
            l1 = [name for name in listdir(fileN) if name.endswith('.mp3') or name.endswith('.flac') or name.endswith('.wma') or name.endswith('.MP3') or name.endswith('.FLAC') or name.endswith('.WMA')]


### 给大家的福利


**零基础入门**


对于从来没有接触过网络安全的同学,我们帮你准备了详细的学习成长路线图。可以说是最科学最系统的学习路线,大家跟着这个大的方向学习准没问题。


![](https://img-blog.csdnimg.cn/img_convert/95608e9062782d28f4f04f821405d99a.png)


同时每个成长路线对应的板块都有配套的视频提供:


![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/a91b9e8100834e9291cfcf1695d8cd42.png#pic_center)


因篇幅有限,仅展示部分资料


网络安全面试题


![](https://img-blog.csdnimg.cn/img_convert/80674985176a4889f7bb130756893764.png)


绿盟护网行动


![](https://img-blog.csdnimg.cn/img_convert/9f3395407120bb0e1b5bf17bb6b6c743.png)


还有大家最喜欢的黑客技术


![](https://img-blog.csdnimg.cn/img_convert/5912337446dee53639406fead3d3f03c.jpeg)


**网络安全源码合集+工具包**


![](https://img-blog.csdnimg.cn/img_convert/5072ce807750c7ec721c2501c29cb7d5.png)


![](https://img-blog.csdnimg.cn/img_convert/4a5f4281817dc4613353c120c9543810.png)

**所有资料共282G**,朋友们如果有需要全套《网络安全入门+黑客进阶学习资源包》,可以扫描下方二维码领取(如遇扫码问题,可以在评论区留言领取哦)~




**网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。**

**[需要这份系统化资料的朋友,可以点击这里获取](https://bbs.csdn.net/forums/4f45ff00ff254613a03fab5e56a57acb)**


**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**

  • 4
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值