Indeed...
Indeed, Allah -azwj has only Forbidden the craft that is entirely unlawful, from which pure corruption results, such as musical instruments, flutes, chess, all forms of distraction, crosses, idols, and similar things, including the production of forbidden drinks and anything from which and in which there is only corruption and there is no aspect of benefit or righteousness.
فَحَرَامٌ تَعْلِيمُهُ وَ تَعَلُّمُهُ وَ الْعَمَلُ بِهِ وَ أَخْذُ الْأَجْرِ عَلَيْهِ وَ جَمِيعُ التَّقَلُّبِ فِيهِ مِنْ جَمِيعِ وُجُوهِ الْحَرَكَاتِ كُلِّهَا إِلَّا أَنْ يَكُونَ صِنَاعَةً قَدْ تُصْرَفُ إِلَى جِهَاتِ الصَّنَائِعِ وَ إِنْ كَانَ قَدْ يُتَصَرَّفُ بِهَا وَ يُتَنَاوَلُ بِهَا وَجْهٌ مِنْ وُجُوهِ الْمَعَاصِي فَلَعَلَّهُ لِمَا فِيهِ مِنَ الصَّلَاحِ حَلَّ تَعَلُّمُهُ وَ تَعْلِيمُهُ وَ الْعَمَلُ بِهِ وَ يَحْرُمُ عَلَى مَنْ صَرَفَهُ إِلَى غَيْرِ وَجْهِ الْحَقِّ وَ الصَّلَاحِ ‘So, it is forbidden to teach it, learn it, work with it, receive payment for it, and engage in it in any form of activity whatsoever, unless it is a craft that can be directed toward beneficial uses, even if it may also be used in aspects of disobedience.
So perhaps, due to the benefit it contains, learning it, teaching it, and working with it becomes permissible, while it is forbidden for anyone to direct it toward anything other than truth and righteousness.
فَهَذَا بَيَانُ تَفْسِيرِ وَجْهِ اكْتِسَابِ مَعَايِشِ الْعِبَادِ وَ تَعْلِيمِهِمْ فِي جَمِيعِ وُجُوهِ اكْتِسَابِهِمْ وُجُوهُ إِخْرَاجِ الْأَمْوَالِ وَ إِنْفَاقِهَا ‘This is an explanation of the interpretation of the aspects of earning, livelihoods of the servants, and their teaching in the entirety of the aspects of their earnings, and aspects of extracting the wealth and spending it.’ Kinds of Spending and Incurred Expenses: وَ أَمَّا الْوُجُوهُ الَّتِي فِيهَا إِخْرَاجُ الْأَمْوَالِ فِي جَمِيعِ وُجُوهِ الْحَلَالِ الْمُفْتَرَضُ عَلَيْهِمْ وَ وُجُوهُ النَّوَافِلِ كُلِّهَا فَأَرْبَعَةٌ وَ عِشْرُونَ وَجْهاً مِنْهَا سَبْعَةُ وُجُوهٍ عَلَى خَاصَّةِ نَفْسِهِ وَ خَمْسَةُ وُجُوهٍ عَلَى مَنْ يَلْزَمُ نَفْسَهُ وَ ثَلَاثَةُ وُجُوهٍ مِمَّا يَلْزَمُهُ فِيهَا مِنْ وُجُوهِ الدَّيْنِ وَ خَمْسَةُ وُجُوهٍ مِمَّا يَلْزَمُهُ فِيهَا مِنْ وُجُوهِ الصِّلَاتِ وَ أَرْبَعَةُ أَوْجُهٍ مِمَّا يَلْزَمُهُ فِيهَا النَّفَقَةُ مِنْ وُجُوهِ اصْطِنَاعِ الْمَعْرُوفِ ‘As for the ways in which wealth is to be spent in all lawful and obligatory forms, as well as in all recommended (non-obligatory) acts, they are twenty-four in total.
✦ ✦ ✦