-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugin-scan.sh
1382 lines (1229 loc) · 46.6 KB
/
plugin-scan.sh
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/sh
# This script scans plugins for the usual drama. It's not going to catch
# everything. It can't. But it can, and will, catch most simple problems.
#
# ./plugin-scan.sh FILENAME.ZIP
# ./plugin-scan.sh URL_TO_ZIP
if (( $BASH_VERSINFO < 4));
then
echo -e "ERROR! Upgrade Bash. Sorry, gotta be 4+."
exit 1
fi
# Validate all Parameters are present
if [[ ! $1 ]]
then
echo -e "ERROR: No file defined."
exit 1
fi
if [[ $1 =~ \.zip$ ]]
then
if [[ $1 == http* ]]
then
echo -e "DOWNLOADING FILE"
wgot=$(basename "$1")
if [[ -f "$wgot" ]]
then
timestamp=$(date +%s)
wgot="$timestamp-$wgot"
wget $1 -q -O $wgot
else
wget $1 -q
fi
zip=$wgot
else
zip=$1
fi
else
if [[ -s $1.zip ]]
then
zip=$1.zip
else
echo -e "ERROR: File does not exist or is not a zip."
exit 1
fi
fi
if [[ ! $2 ]];then
param=default
else
for validparam in echo phpcs force
do
if [[ $2 = $validparam ]];then
param=$validparam
fi
done
fi
echo -e "UNZIPPING FILE ..."
unzip -qq "$zip" -d current_plugin
if [ ! -d "current_plugin" ]
then
echo -e "ERROR: Unzip failed."
exit 1
fi
if [ -d "current_plugin/__MACOSX/" ]
then
rm -rf current_plugin/__MACOSX/
fi
if [ -f "current_plugin/.DS_Store" ]
then
rm -rf current_plugin/.DS_Store
fi
echo -e "BEGINNING SCAN ..."
## Do we die?
stopevil=false
## Create Files
filename=${zip%.*}-review-$param.php
tempfile=${zip%.*}-temp.txt
phpcsfile=${zip%.*}-phpcs.txt
touch "$filename"
echo -e "<?php" >> "$filename"
echo -e "\n\nScanning "$zip" -- $(date)" >> "$filename"
## Do the checks
# People attempting to PoC
ag --path-to-ignore $0.ignore --skip-vcs-ignores 'This is Testing for poc' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## DANGER! THIS PLUGIN IS TRYING TO TEST A 'PLUGIN CONFUSION' ISSUE. REJECT AND INFORM." >> "$filename"
paste "$tempfile" >> "$filename"
stopevil=true
fi
# Source Guardian code is not allowed
ag --path-to-ignore $0.ignore --skip-vcs-ignores 'sourceguardian.com' current_plugin/ >> "$tempfile"
ag --path-to-ignore $0.ignore --skip-vcs-ignores 'function_exists/(/'sg_load/'/)' current_plugin/ >> "$tempfile"
ag --path-to-ignore $0.ignore --skip-vcs-ignores '$__x=' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## ALERT: Source Guardian is meant to HIDE the code from being read. Do not allow." >> "$filename"
paste "$tempfile" >> "$filename"
stopevil=true
fi
> "$tempfile"
# Note -- there is a whole lot of other examples here, but they list specific people who were banned so it's not available here.
if [[ "$param" = force ]];then
stopevil=false
param=default
fi
## If we made it past the evil people check, we do the rest.
if [ "$stopevil" = false ] && [ "$param" = default ]; then
# applications don't belong but sometimes people get fonts and PHP set as applications.
find ./current_plugin/ -type f -exec file --mime-type {} \; | awk '{if ($NF == "application/octet-stream") print $0 }' >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## CAUTION: Application files are generally not permitted. See what's up." >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Readme Missing
find current_plugin -type f -iname "readme.txt" >> "$tempfile"
if [[ ! -s "$tempfile" ]]
then
find current_plugin -type f -iname "readme.md" >> "$tempfile"
if [[ ! -s "$tempfile" ]]
then
echo -e "\n## WARNING: No Readme TXT or MD found." >> "$filename"
else
readme=`find current_plugin -type f -iname "readme.md"`
fi
else
readme=`find current_plugin -type f -iname "readme.txt"`
fi
> "$tempfile"
# Readme Defaults commonly missed
ag --path-to-ignore $0.ignore -G 'readme.txt' 'this should be a list of wordpress.org userid' current_plugin/ >> "$tempfile"
ag --path-to-ignore $0.ignore -G 'readme.txt' 'Here is a short description of the plugin.' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## WARNING: readme.txt contains default content" >> "$filename"
fi
> "$tempfile"
# Names
ag -G 'readme.txt' '=== ' current_plugin/ >> "$tempfile"
ag -G 'readme.md' '=== ' current_plugin/ >> "$tempfile"
ag --path-to-ignore $0.ignore --php --skip-vcs-ignores "Plugin Name:" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## README: Check name for Trademarks" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Tested Up To
echo -e "\n## README: Check Tested Up To Major Version" >> "$filename"
ag -G 'readme.txt' 'tested up to:' current_plugin/ >> "$tempfile"
ag -G 'readme.md' 'tested up to:' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
paste "$tempfile" >> "$filename"
else
echo -e "No 'Tested up to' value found in readme." >> "$filename"
fi
> "$tempfile"
# Stable Tag
echo -e "\n## README: Check stable tags (they should match the version and NOT be trunk)" >> "$filename"
ag -G 'readme.txt' 'stable tag:' current_plugin/ >> "$tempfile"
ag -G 'readme.md' 'stable tag:' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
paste "$tempfile" >> "$filename"
else
echo -e "No 'Stable Tag' value found in readme.txt." >> "$filename"
fi
> "$tempfile"
ag --path-to-ignore $0.ignore --php --skip-vcs-ignores "version:" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
paste "$tempfile" >> "$filename"
else
echo -e "\nNo 'Version' value found in plugin headers." >> "$filename"
fi
> "$tempfile"
# Stop people from trying to override the updater
# https://make.wordpress.org/core/2021/06/29/introducing-update-uri-plugin-header-in-wordpress-5-8/
ag --path-to-ignore $0.ignore --php --skip-vcs-ignores "Update URI:" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NOT PERMITTED: Use of Update URI is not helpful in plugins hosted on .org, please remove." >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Don't let people hurt users
ag --path-to-ignore $0.ignore --php --skip-vcs-ignores "ALLOW_UNFILTERED_UPLOADS" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NOT PERMITTED: Use of ALLOW_UNFILTERED_UPLOADS is disallowed." >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Common 3rd Party resources that forgets to have licences
for thirdparty in corona.lmao.ninja covid19api.com domo.com ipecho.com
do
ag --path-to-ignore $0.ignore --skip-vcs-ignores $thirdparty current_plugin/ >> "$tempfile"
done
if [[ -s "$tempfile" ]]
then
echo -e "\n## README: Third parties MUST have privacy notes in the readme." >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Check to see if they call wordpress.org anywhere
ag --path-to-ignore $0.ignore --php --skip-vcs-ignores "wordpress.org" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## CHECK: Check to make sure .org calls are to their plugin and non-abusive" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
## BEGIN QUICK CHECKS
# Referencing Automattic
ag --php --path-to-ignore $0.ignore --skip-vcs-ignores "Automattic" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## CHECK: Namedropping A8C may be a copy/theft" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Including Woo-Includes Directory or the files.
find current_plugin -type d -name "woo-includes" >> "$tempfile"
ag --php --skip-vcs-ignores "woothemes_queue_update" current_plugin/ >> "$tempfile"
ag --php --skip-vcs-ignores "woothemes_updater_install" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NOT PERMITTED: Woo-Includes folder is not needed" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Unicode UTF8
ag --path-to-ignore $0.ignore --php --skip-vcs-ignores "u00" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NOT PERMITTED: Unicode UTF-8 Obfuscation in PHP" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Unicode UTF8
ag --path-to-ignore $0.ignore --js --files-with-matches "u00" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NOT PERMITTED: Unicode UTF-8 Obfuscation in JS" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Eval
ag --path-to-ignore $0.ignore --php "eval(" -Q current_plugin/ >> "$tempfile"
ag --path-to-ignore $0.ignore --php "eval (" -Q current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NEEDS REVIEW: Eval should be avoided whenever possible (be aware for flase pos with JS)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# shell_exec
ag --path-to-ignore $0.ignore --php "shell_exec" -Q current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NEEDS REVIEW: Shell EXEC should not be used" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Plugin Update Checker
ag --skip-vcs-ignores "domain = 'plugin-update-checker';" current_plugin/ >> "$tempfile"
find current_plugin -type f -name 'plugin-update-checker.php' >> "$tempfile"
ag --skip-vcs-ignores "domain = 'WP_GitHub_Updater';" current_plugin/ >> "$tempfile"
ag --skip-vcs-ignores "domain = 'WPGitHubUpdater';" current_plugin/ >> "$tempfile"
ag --skip-vcs-ignores "class EDD_SL_Plugin_Updater" current_plugin/ >> "$tempfile"
ag --skip-vcs-ignores "updater.wbbdev.com" current_plugin/ >> "$tempfile"
ag --skip-vcs-ignores "site_transient_update_plugins" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NOT PERMITTED: Plugin Update Checker" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Touching updaters
ag --path-to-ignore $0.ignore --skip-vcs-ignores "pre_set_site_transient_update_" current_plugin/ >> "$tempfile"
ag --path-to-ignore $0.ignore --skip-vcs-ignores "auto_update_plugin" current_plugin/ >> "$tempfile"
ag --path-to-ignore $0.ignore --skip-vcs-ignores "_site_transient_update_core" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NEEDS REVIEW: Plugin may be messing with updates." >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# ionCube
ag --path-to-ignore $0.ignore --skip-vcs-ignores "ionCube" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NOT PERMITTED: ionCube" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Curl
ag --path-to-ignore $0.ignore --skip-vcs-ignores "curl_exec" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NOT PERMITTED: Curl, use HTTP API" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# file_get_contents
ag --path-to-ignore $0.ignore --php --skip-vcs-ignores "file_get_contents" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NOT PERMITTED: file_get_contents, use HTTP API" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# move_uploaded_file
ag --path-to-ignore $0.ignore --php --skip-vcs-ignores "move_uploaded_file" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NOT PERMITTED: move_uploaded_file, use WP functions." >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Create User
ag --path-to-ignore $0.ignore --php --skip-vcs-ignores "wp_create_user" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NOT PERMITTED: wp_create_user is often used to make backdoor accounts" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# PACKER
ag --path-to-ignore $0.ignore --skip-vcs-ignores "p,a,c,k" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NOT PERMITTED: packer" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Zips
find current_plugin -type f -name '*.zip' >> "$tempfile"
find current_plugin -type f -name '*.gz' >> "$tempfile"
find current_plugin -type f -name '*.tgz' >> "$tempfile"
find current_plugin -type f -name '*.rar' >> "$tempfile"
find current_plugin -type f -name "*.phar" >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NOT PERMITTED: Contains Compressed file" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Powered·by
ag -G --skip-vcs-ignores "powered·by" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NOT PERMITTED: Powered·by must be Opt IN" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# ACF Pro
ag -G 'acf.php' 'Plugin Name: Advanced Custom Fields PRO' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NOT PERMITTED: Pro version of ACF, need to use free." >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Losthost
ag --path-to-ignore $0.ignore --php "http://localhost" current_plugin/ >> "$tempfile"
ag --path-to-ignore $0.ignore --php "https://localhost" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NEEDS REVIEW: calling localhost" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Base64
ag --path-to-ignore $0.ignore --php "base64_" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NEEDS REVIEW: base64" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# str_rot13
ag --path-to-ignore $0.ignore --php "str_rot13" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NEEDS REVIEW: str_rot13" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# hex2bin
ag --path-to-ignore $0.ignore --php "hex2bin" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NEEDS REVIEW: hex2bin" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# IFRAMES
ag --path-to-ignore $0.ignore --php "<iframe" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NEEDS REVIEW: iframes are not allowed on Admin pages" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Sending email
ag --path-to-ignore $0.ignore --php --skip-vcs-ignores "wp_mail" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NEEDS REVIEW: wp_mail may be used to track users" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# jQuery
ag --path-to-ignore $0.ignore --js -l "jquery.org/license" current_plugin/ >> "$tempfile"
ag --path-to-ignore $0.ignore --js -l "jqueryui.com" current_plugin/ >> "$tempfile"
find current_plugin -type f -name 'jquery-ui.js' >> "$tempfile"
find current_plugin -type f -name 'jquery-ui.min.js' >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NEEDS REVIEW: jQuery already included in WP" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Offloaded Files
for offload in googleapis.com code.jquery.com cdn.cloudflare.com cloudflare.com cdn.jsdelivr.net cdn.rawgit.com code.getmdl.io bootstrapcdn cl.ly cdn.datatables.net raw.githubusercontent.com unpkg.com imgur.com rawgit.com amazonaws.com cdn.tiny.cloud tiny.cloud tailwindcss.com
do
ag --width 200 --path-to-ignore $0.ignore --skip-vcs-ignores $offload current_plugin/ >> "$tempfile"
done
if [[ -s "$tempfile" ]]
then echo -e "\n## NEEDS REVIEW: Offloaded Files" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Remote Images
ag --path-to-ignore $0.ignore --php --skip-vcs-ignores -Q 'img src="http' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NEEDS REVIEW: External images" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Font Awesome
ag --path-to-ignore $0.ignore --skip-vcs-ignores "kit.fontawesome." current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NEEDS REVIEW: Font Awesome (look for custom URL)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Core Has
# Missing Checks for:
# [ 'Class POP3', 'https://squirrelmail.org/' ],
# [ 'PemFTP', 'https://www.phpclasses.org/packag --path-to-ignore $0.ignoree/1743-PHP-FTP-client-in-pure-PHP.html' ],
# [ 'Redux', 'https://redux.js.org/' ],
# [ 'The Incutio XML-RPC Library', 'http://scripts.incutio.com/xmlrpc/' ],
# [ 'TinyMCE', 'https://www.tinymce.com/' ],
# [ 'whatwg-fetch', 'https://github.com/github/fetch' ],
for corefile in polyfill.js backbone.js clipboard.js clipboard.min.js closest.js codemirror.js jquery.color.js getid3.php FormData.js formdata.min.js jquery.hoverIntent* jquery.imgareaselect.* jquery.hotkeys.js jquery.ba-serializeobject.js iris* jquery.query-object.js jquery.suggest.js jquery.ui.touch-punch.min.js jquery.ui.touch-punch.js json2.js lodash.js masonry.js masonry.pkgd.min.js masonry.pkgd.js mediaelement-and-player.min.js moment.js moment.min.js pclzip.lib.php PasswordHash.php PHPMailer.php plupload.min.js plupload.full.min.js SimplePie.php thickbox.js twemoji.js twemoji.min.js underscore-min.js underscore.js zxcvbn.js plupload.full.js plupload.full.min.js moxie.js
do
find current_plugin -type f -name $corefile >> "$tempfile"
done
ag --path-to-ignore $0.ignore -G 'Requests.php' -Q 'Requests for PHP' current_plugin/ >> "$tempfile"
ag --path-to-ignore $0.ignore -G 'random.php' -Q 'Random_* Compatibility Library' current_plugin/ >> "$tempfile"
ag --path-to-ignore $0.ignore --skip-vcs-ignores --php 'Horde_Text_Diff' current_plugin/ >> "$tempfile"
ag --path-to-ignore $0.ignore -G '.js' 'benalman.com/projects/jquery-misc-plugins/' current_plugin/ >> "$tempfile"
#ag --path-to-ignore $0.ignore -G '.js' 'license React' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NEEDS REVIEW: May be including files core has" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Sessions
for sessions in ob_st session_
do
ag --path-to-ignore $0.ignore --skip-vcs-ignores --php $sessions current_plugin/ >> "$tempfile"
done
if [[ -s "$tempfile" ]]
then
echo -e "\n## NEEDS REVIEW: php sessions can break caching, make sure it's encapsulated" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# wp-(conf|load|blog)
ag --path-to-ignore $0.ignore --skip-vcs-ignores --php 'wp-(conf|load|blog)' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NEEDS REVIEW: direct calls to wp-(conf|load|blog) not allowed" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# POST|REQ|FILE|GET
ag --path-to-ignore $0.ignore --skip-vcs-ignores '\$_(POST|REQ|SERVER|FILE|GET|COOK|SESS)' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NEEDS REVIEW: POST|REQ|FILE|GET must be sanitized/escaped" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Echo check
ag --path-to-ignore $0.ignore --php -Q 'echo' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NEEDS REVIEW: Echoed variables have to be escaped" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Echo check
ag --path-to-ignore $0.ignore --php -Q 'add_query_arg' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NEEDS REVIEW: add_query_arg has to be escaped when output" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# May be writing to files
ag --path-to-ignore $0.ignore --skip-vcs-ignores --php "file_put_contents" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NEEDS REVIEW: May be writing to files" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# MPDF - https://mpdf.github.io/ -- https://github.com/mpdf/mpdf/releases
ag -G 'mpdf.php' 'mPDF_VERSION' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: mPDF 8.1.0+ (16 April 2022)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# elFinder - https://github.com/Studio-42/elFinder
ag -G 'elfinder.min.js' ' Version = ' current_plugin/ >> "$tempfile"
ag -G 'elfinder.version.js' 'elFinder.prototype.version' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: elFinder v2.1.61+ (26 July 2022)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Freemius - https://github.com/Freemius/wordpress-sdk
ag -G 'start.php' 'this_sdk_version = ' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: Freemius v2.4.5+ OR v2.5.3 (13 Dec 2022)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Wisdom Plugin - https://wisdomplugin.com/support
ag -G 'class-plugin-usage-tracker.php' -Q '* @version ' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: Wisdom Plugin v1.2.4+ (??)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# FPDF - http://www.fpdf.org
ag -G 'fpdf.php' -Q 'FPDF_VERSION' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: FPDF v1.82+ (27 Aug 2020)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Chart.JS - https://github.com/chartjs/Chart.js
ag --js -Q '* Chart.js' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: Chart.js v3.8.2+ (26 July 2022)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# ChartIst.JS - https://github.com/gionkunz/chartist-js/
ag --js -Q '* Chartist.js ' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: Chartist.js v.11.4+ (13 September 2021) No updates in 3 years" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# FancyBox - https://github.com/fancyapps/fancybox
ag --js '// fancyBox v' current_plugin/ >> "$tempfile"
ag --js 'fancyBox - jQuery Plugin' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: FancyBox v1 OR v3, not v2 (cc3) OR v4 (commercial) -- current v3.5.7+ (27 Aug 2020)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Action scheduler - https://github.com/woocommerce/action-scheduler
ag -G 'action-scheduler.php ' -Q "* Version:" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: Action Scheduler v3.4.2+ (8 June 2022)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Parsedown - https://github.com/erusev/parsedown
ag -G 'parsedown.php ' -Q "const version" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: Parsedown v1.7.4+ (30 Dec 2019)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# WP Session Manager - https://github.com/ericmann/wp-session-manager/
ag -G 'wp-session-manager.php ' -Q "* Version:" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: Action Scheduler v4.2.0+ (30 Mar 2019)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Option Tree
ag -G 'ot-loader.php' -Q "define( 'OT_VERSION'" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: Option Tree v2.7.3+ (18 May 2019)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# CMB2 - https://github.com/CMB2/CMB2
ag -G 'init.php' 'const VERSION =' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: CMB2 v2.10.1+ (22 Feb 2022)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# MetaBox - https://wordpress.org/plugins/meta-box/
ag -G 'meta-box.php' 'Version:' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: Meta Box v5.6.5+ (10 Jul 2022)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# KIRKI - https://wordpress.org/plugins/kirki/
ag -G 'kirki.php' ' Version: ' current_plugin/ >> "$tempfile"
ag -G "settings.php" "define\( 'KIRKI_VERSION'" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: Kirki v4.0.24+ (1 May 2022)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# twilio-php-master - https://github.com/twilio/twilio-php // https://packagist.org/packages/twilio/sdk
ag -G 'VersionInfo.php' ' const MAJOR =' current_plugin/ >> "$tempfile"
ag -G 'VersionInfo.php' ' const MINOR =' current_plugin/ >> "$tempfile"
ag -G 'VersionInfo.php' ' const PATCH =' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: Twillo v6.40.0+ (21 July 2022)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# TGM - https://github.com/TGMPA/TGM-Plugin-Activation
ag -G 'class-tgm-plugin-activation.php' ' Version: ' current_plugin/ >> "$tempfile"
ag -G 'class-tgm-plugin-activation.php' '@version ' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: TGM v2.6.1+ (19 May 2016)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# ACF - https://wordpress.org/plugins/advanced-custom-fields/
ag -G 'acf.php' 'Version: ' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: ACF v6.0.5+ (21 November 2022)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# PHP QR Code - http://phpqrcode.sourceforge.net
ag -G 'phpqrcode.php' 'Version: ' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: PHP QR Code v1.1.4+ (07 Oct 2010)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# SimpleDom - https://sourceforge.net/projects/simplehtmldom/files/
ag -G 'simple_html_dom.php' 'ersion Rev. ' current_plugin/ >> "$tempfile"
ag -G 'simple_html_dom.php' '@version ' current_plugin/ >> "$tempfile"
ag -G 'simplehtmldom.php' 'ersion Rev. ' current_plugin/ >> "$tempfile"
ag -G 'simplehtmldom.php' '@version ' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: simple_html_dom v1.9.1 (291) (11 Nov 2019)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# DOMPDF - https://github.com/dompdf/dompdf
find current_plugin -type f -name "Dompdf.php" >> "$tempfile"
find current_plugin -type f -name "dompdf.php" >> "$tempfile"
if [[ -s "$tempfile" ]]
then
> "$tempfile"
echo -e "\n## VERSION CHECK: DOMPDF 2.0 (23 Jun 2022)" >> "$filename"
find current_plugin -type f -name "VERSION" >> "$tempfile"
find current_plugin -type f -name "VERSION" -exec cat '{}' ';' >> "$tempfile"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
find current_plugin -type f -name "VERSION" >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: DOMPDF 2.0 (23 Jun 2022)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Isotope - https://unpkg.com/isotope-layout@3.0.6/dist/isotope.pkgd.min.js
ag -G 'isotope' 'Isotope PACKAGED' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: Isotope v3.0.6+ (27 Aug 2020)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Nusoap - https://github.com/pwnlabs/nusoap
ag -G 'nusoap.php' 'var $version = ' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: NUsoap v0.9.12+ (26 April 2022)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Redux - https://wordpress.org/plugins/redux-framework/
ag -G 'class.redux-plugin.php' 'const VERSION = ' current_plugin/ >> "$tempfile"
ag -G 'framework.php' 'public static \$_version =' current_plugin/ >> "$tempfile"
ag -G 'framework.php' 'Redux_Core::\$version' current_plugin/ >> "$tempfile"
ag -G 'redux-framework.php' 'Version:' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: Redux v4.3.16+ (25 July 2022)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Cherry - https://github.com/CherryFramework/cherry-framework
ag -G 'cherry-core.php' ' Version:' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: Cherry Framework v1.5.11+ (22 Nov 2021)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Mustach.php - https://github.com/bobthecow/mustache.php
ag -G 'Engine.php' 'const VERSION' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: Mustache.php v2.14.1 (20 Jan 2022)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Bootstrap - https://github.com/twbs/bootstrap
ag -G 'bootstrap.' 'Bootstrap v' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: Bootstrap v5.2.1 (7 Sept 2022), v5.1.3 (9 Oct 2021), 4.6.2 (24 July 2022) " >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Bootstrap Date Picker - https://github.com/uxsolutions/bootstrap-datepicker
ag -G 'bootstrap-datepicker' 'Datepicker for Bootstrap v' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: Bootstrap Date Picker v1.9.0+ (20 May 2019)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Bootstrap Color Picker - https://github.com/itsjavi/bootstrap-colorpicker/
ag -G 'bootstrap-colorpicker' 'Bootstrap Colorpicker v' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: Bootstrap Color Picker v3.4.0+ (4 June 2021)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Codestar - https://github.com/Codestar/codestar-framework/
ag -G 'framework.php' ' Version:' current_plugin/ >> "$tempfile"
ag -G 'cs-framework.php' ' Version:' current_plugin/ >> "$tempfile"
ag -G 'cs-framework-path.php' 'CS_VERSION' current_plugin/ >> "$tempfile"
ag -G 'csf-config.php' ' Version:' current_plugin/ >> "$tempfile"
ag -G 'codestar-framework.php' ' Version:' current_plugin/ >> "$tempfile"
ag -G 'setup.class.php' 'public static \$version' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: Codestar v2.2.8+ (13 Apr 2022)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Carbon Fields - https://github.com/htmlburger/carbon-fields
ag -G 'carbon-fields-plugin.php' -Q '* Version:' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: Carbon Fields v3.3.4+ (5 May 2022)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Winter MVC - https://github.com/sandiwinter/winter_mvc
ag -G 'database.php' -Q ' * @version' current_plugin/ >> "$tempfile"
ag -G 'init.php' -Q '$Winter_MVC_version_this' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: Winter MVC 2.3 (9 June 2022)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Adminer - https://www.adminer.org/
ag -G 'adminer' -Q '@version ' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: Adminer v4.8.1+ (14 May 2021)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# SimpleXLS - https://github.com/shuchkin/simplexlsx
ag -G 'simplexlsx.class.php' -Q ' * @version' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: SimpleXLSX php class v1.0.16+ (1 Jan 2022)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# MediaElement - http://mediaelementjs.com/
ag -G 'mediaelement.js' -Q 'mejs.version =' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: mediaelementjs v5.0.5+ (1 Jan 2022)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# CKEditor - https://github.com/ckeditor/ckeditor5
ag -W 10 -G 'ckeditor.js' -Q 'version:"' current_plugin/ >> "$tempfile"
ag -W 10 -G 'ckeditor.js' -Q 'CKEDITOR_VERSION="' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: CKEditor v34.2.0 (28 June 2022)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Tiny MCE - https://www.tiny.cloud/get-tiny/self-hosted/
ag -G 'tinymce.min.js' -Q 'Version:' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: TinyMCE v6.1.x (1 July 2022) -- No plans for core to update to 5 - https://core.trac.wordpress.org/ticket/47218" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Swipebox - https://github.com/brutaldesign/swipebox
find current_plugin -type f -iname "jquery.swipebox.min.js" >> "$tempfile"
find current_plugin -type f -iname "jquery.swipebox.js" >> "$tempfile"
ag --js "Swipebox" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: Swipebox 1.5.2 (22 Jan 2021)" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# Moment.JS - https://momentjs.com/
ag -W 10 -G 'moment.js' -Q 'version:"' current_plugin/ >> "$tempfile"
ag -W 10 -G 'moment.min.js' -Q '//! version : ' current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## VERSION CHECK: Moment.JS 2.29.3 (5 May 2022) -- also it's included in core" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
# SweetAlert remote-data calls
ag --width 100 "leave-russia-now-and-apply-your-skills-to-the-world" current_plugin/ >> "$tempfile"
ag --width 100 "fWClXZd9c78" current_plugin/ >> "$tempfile"
ag --width 100 "noWarMessageForRussians" current_plugin/ >> "$tempfile"
ag --width 100 "flag-gimn" current_plugin/ >> "$tempfile"
find current_plugin -type f -iname "sweetalert.js" >> "$tempfile"
find current_plugin -type f -iname "sweetalert2.min.js" >> "$tempfile"
find current_plugin -type f -iname "sweetalert2.all.js" >> "$tempfile"
find current_plugin -type f -iname "sweetalert.min.js" >> "$tempfile"
find current_plugin -type f -iname "sweetalert2.js" >> "$tempfile"
find current_plugin -type f -iname "sweetalert.css" >> "$tempfile"
find current_plugin -type f -iname "sweetalert.css" >> "$tempfile"
if [[ -s "$tempfile" ]]
then
echo -e "\n## NEEDS REVIEW: SweetAlert versions that make remote data calls are not allowed" >> "$filename"
paste "$tempfile" >> "$filename"
fi
> "$tempfile"
## BEGIN GPL/LICENSING SECTION
# CreativeCommons
ag --width 100 --path-to-ignore $0.ignore --skip-vcs-ignores "creativecommons" current_plugin/ >> "$tempfile"
if [[ -s "$tempfile" ]]
then